Update Multiple AD Objects Using PowerShell

Adaxes provides a PowerShell module that allows administrators to perform operations on Active Directory objects from the command line. In this tutorial, you will learn how to use Adaxes PowerShell cmdlets to perform bulk operations on multiple Active Directory objects at once.

To use Adaxes PowerShell cmdlets you need to install Adaxes PowerShell Module.

Cmdlets included in Adaxes PowerShell Module are similar to Microsoft cmdlets for Active Directory. The difference is that when using Adaxes cmdlets you benefit from automated provisioning, data standard enforcement, approval-based workflow, etc. For example, when a new user account is created using cmdlet New-AdmUser, Adaxes can create an Exchange mailbox for the user, add the user to the necessary groups, move the account to the correct Organizational Unit, assign licenses in Office 365, etc. For more details, see Automate User Provisioning.

To start using the PowerShell module, open the Adaxes PowerShell command prompt.

Alternatively, you can launch the Windows PowerShell console and use the Import-Module Adaxes command to import the Adaxes module.

Adaxes PowerShell cmdlets can interact with Active Directory either via Adaxes service or directly (bypassing the Adaxes service). To specify the Adaxes service you want to connect to, use the -AdaxesService parameter:

Set-AdmUser -Identity 'lisa.wilson' -Country 'US' -Server example.com`
	-AdaxesService localhost

Another way to do it is to 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

For more details, see Import User Accounts from a CSV File.

Example 2:  Set the homepage of all users from the 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 the LastName, FirstName format.

Get-AdmUser -Filter * -Server example.com | % { Set-AdmUser $_ -DisplayName`
    ($_.LastName + ', ' + $_.FirstName) -Server example.com}

For more examples and information on the cmdlets included in the Adaxes PowerShell module, see Adaxes PowerShell Module.
Open tutorial filtering

Got questions?
Support Forum