Friday , April 26 2024
Home - Tag Archives: scripting

Tag Archives: scripting

Easy Find OU in a DistinguishedName with PowerShell

There are a couple of ways to find the OU of an Object, some are long-winded ways splitting and counting characters.  The best way I’ve come up with for a quick and case insensitive check: [crayon-662b1ed93581a675600788/] A better example of the use in code: [crayon-662b1ed935821671099376/] The Case Culture fixes up the compare of string being a different case of “OU=”, …

Read More »

Using PowerShell to Connect to Domino NAB

There are times where I need to compare Domino Address Books (NAB) to Active Directory.  Using PowerShell to connect to Domino NAB solves this with ease, although we have to use logon details with no authentication method.  A little strange but Domino accepts the ‘[System.DirectoryServices.AuthenticationTypes]::None’ fromPowerShell. [crayon-662b1ed935c58575259435/] Changing DominoSrv01, Organisation Name, Username and Password for the environment. [crayon-662b1ed935c5d116682177/] Make a connection …

Read More »

Creating Dynamic Distribution Groups

Ive been asked to create a Distribution Group based on Users City Value.  The following Powershell commands create a example Office based group. Once Powershell for On-premises or Office 365 shell has been started.  Enter the following command changing as required: [crayon-662b1ed936c4e516164193/] To enable the Mail tip use this additional command: [crayon-662b1ed936c5a820517850/] The following command will test and display which users will receive the email from …

Read More »

Powershell Get-Counters in a usable form from CookedValue

Sometime ago now I was given the challenge to get the value out of a get-counter in a Powershell, I thought the answer snippet should be posted for future reference. The following Powershell command gives a value buried with result information. [crayon-662b1ed93717f020948397/] The result is given: [crayon-662b1ed937186604703691/] To get the true value to be used in other powershell code we …

Read More »

Updating Active Directory User Objects from CSV files

Sometimes it’s better to get updates for Active Directory objects supplied in the form of a Excel spreadsheet.  Using the information you can then run the following script to update objects with information contain the rows/columns of a spreadsheet (CSV file).  What makes this a little simplier the column headers are the AD properties to be udpated. Another issue covered in …

Read More »

Exchange 2010 Add Mailbox folder permissions including subfolders

I’m always asked how to add a user to have Mailbox folder permissions for a folder and sub-folder in another users mailbox.  Exchange 2010 (SP1 for Set)  includes to new commands ‘Add-MailboxFolderPermission’ and ‘Set-MailboxFolderPermission’. Save the following in a new .ps1 file and run with Exchange management rights making changes to the script as required. ForEach($folder in (Get-MailboxFolderStatistics MailAliasofSharer| Where { …

Read More »

Active Directory Password Last Changed Export Tool

VBScript program to output all users in the domain with the date and time that each last changed their password. If passwords expire for all users, this program can be used to identify old unused accounts that can be disabled and eventually deleted. This program uses the pwdLastSet attribute to determine when the password was last set. Because this attribute …

Read More »

Scripting Windows 2008 DHCP for ISP Failover

Having two ISP connections and switch between them automatically is more a hardware (or Software -TMG) solution.  But I found a way to script the Windows DHCP server using the netsh command. This allows for a site admin to run either of two scripts to change the default gateway on the server(s) and dhcp scope options for clients. An example of such …

Read More »