Update multiple objects using PowerShell

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

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

How the module works

Cmdlets included in Adaxes PowerShell Module are similar to Microsoft cmdlets for Active Directory like New-ADUser, Get-ADGroup, etc. However, when you use Adaxes cmdlets, you can perform operations in both Active Directory and Microsoft Entra managed domains. You also benefit from Adaxes features like automated provisioning, data standard enforcement, approval-based workflow, etc.

For example, when a new user account is created using the New-AdmUser cmdlet, Adaxes can create an Exchange mailbox for the user, assign licenses in Microsoft 365, add the user to the necessary groups, move the account to the correct organizational unit, etc. For more details, see Automate user provisioning.

Using the module

Adaxes PowerShell cmdlets can perform operations in your directory either via Adaxes service, or directly (bypassing the Adaxes service). A cmdlet is executed via Adaxes service if you use the -AdaxesService parameter. In this case, all business rules, property patterns, etc. are applied.

The bypass mode is available solely for operations in Active Directory domains. If you need to perform operations on Microsoft Entra objects, you have to use the -AdaxesService parameter.

To perform an operation via Adaxes service, specify the host name of an Adaxes service as the parameter value:

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

Another way to perform an operation via Adaxes service is to use the Adaxes PowerShell provider:

cd adaxes:
cd localhost/example.com
Set-AdmUser -Identity 'lisa.wilson' -Country 'US'

Otherwise, the operation will be performed in bypass mode.

Criteria

If the -AdaxesService parameter is specified, the -Filter parameter of all Adaxes cmdlets will accept Adaxes criteria expressions in addition to the standard PowerShell filter syntax. Criteria simplifies creating queries that would otherwise be too complex or even impossible.

 Examples
{mailboxType -eq "shared"} # Shared mailboxes
{groupType -eq "microsoft 365"} # Microsoft 365 groups
{allManagers -eq "CN=John Smith,CN=Users,DC=example,DC=com"} # All subordinates of a user

For details on how to build criteria, see How to build criteria.

Example 1 – Import users from a CSV file

Import-CSV 'C:\users.csv' | New-AdmUser -Server "example.com" -AdaxesService localhost

For more details, see Schedule import of users from CSV.

Example 2 – Add all disabled user accounts to a group

Get-AdmUser -Filter {accountDisabled -eq $true} -AdaxesService localhost | 
    % { Add-AdmGroupMember -Identity 'DisabledAccountsGroup' -Members $_ -AdaxesService localhost} 

Example 3 – Change the display name of all users to the LastName, FirstName format

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

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