Update Multiple AD Objects Using PowerShell
Adaxes includes a PowerShell module for Active Directory that allows administrators to automate routine Active Directory management tasks and perform bulk operations in AD from the command line. In this tutorial you will learn how to use the Adaxes PowerShell cmdlets to perform operations on multiple Active Directory objects.
The cmdlets included in the Adaxes PowerShell module are similar to those included in the Microsoft PowerShell Active Directory module for Windows Server 2008 R2. However, when Active Directory cmdlets are used together with Adaxes service, you get some extra benefits including automated provisioning, approval-based workflow, enterprise standard enforcement, etc.
To get a list of all cmdlets contained in the Adaxes PowerShell module, you can use the Get-Command -Module Adaxes command. To learn about what each cmdlet does, use the built-in PowerShell help documentation via the Get-Help command, for example: Get-Help Get-AdmUser -Full.
To start using the Adaxes PowerShell module, use the PowerShell Module for Active Directory shortcut in the Windows start menu.
Or launch the Windows PowerShell console and use the Import-Module cmdlet to import the Adaxes module: Import-Module adaxes
Using Adaxes PowerShell Module
Here you will find some examples of using the Adaxes PowerShell cmdlets to perform bulk operations on Active Directory objects.
Set-AdmUser -Identity 'lisa.wilson' -Country 'US' -Server example.com -AdaxesService localhost
Or use the Adaxes PowerShell provider:
cd adaxes:
cd localhost/example.com
Set-AdmUser -Identity 'lisa.wilson' -Country 'US'
Example 1: Import users to Active Directory from a CSV file:
Import-CSV C:\users.csv | New-AdmUser -Server example.com
Example 2: Set the homepage of all users from Sales department to http://example.com/sales/%username%
Get-AdmUser -Filter {Department -eq "Sales"} | % {Set-AdmUser $_ -HomePage ('http://example.com/sales/'
+ $_.SamAccountName)}
Example 3: Add all disabled user accounts to a group:
Search-AdmAccount -AccountDisabled -UsersOnly -Server example.com | % { Add-AdmGroupMember
-Identity 'DisabledAccountsGroup' -Members $_ -Server example.com}
Example 4: Change the display name of all Active Directory users using format
'LastName, FirstName':
Get-AdmUser -Filter * -Server example.com | % { Set-AdmUser $_ -DisplayName ($_.LastName
+ ', ' + $_.FirstName) -Server example.com}
