Home » Office 365 » Add-MsolAdministrativeUnitMember

Add-MsolAdministrativeUnitMember

The Add-MsolAdministrativeUnitMember cmdlet in PowerShell adds a member to an administrative unit in Microsoft Office 365.

The syntax to add a new member to an administrative unit in the Azure Active Directory is given below.

Add-MsolAdministrativeUnitMember
   -AdministrativeUnitObjectId <Guid>
   [-AdministrativeUnitMemberObjectId <Guid>]
   [-TenantId <Guid>]
   [<CommonParameters>]

In this article, we will discuss how to use the Add-MsolAdministrativeUnitMember cmdlet in PowerShell to add a member to an administrative unit.

How to Add a Member to an Administrative Unit in Office 365

To add a member to an administrative unit in Office 365 with PowerShell, use the Add-MsolAdministrativeUnit cmdlet.

# Get the administrative unit from Azure Active Directory
$AdministrativeUnit = Get-MsolAdministrativeUnit -SearchString "East Coast"  

# Get the MsolUser
$User = Get-MsolUser -UserPrincipalName "[email protected]" 

# Add a member to the administrative unit
Add-MsolAdministrativeUnitMember -AdministrativeUnitObjectId $AdministrativeUnit.ObjectId -AdministrativeUnitMemberObjectId $User.ObjectId

The Get-MsolAdministrativeUnit cmdlet in PowerShell gets an administrative unit that matches the search string “East Coast” and stores the administrative unit in the $AdministrativeUnit variable.

The Get-MsolUser command in PowerShell gets a user using the user principal name “[email protected]” and stores the user in the $User variable.

The Add-MsolAdministrativeUnitMember command adds the user in $User to the administrative Unit in the $AdministrativeUnit. Both variables are identified by ObjectId.

Conclusion

I hope the above article on how to use the Add-MsolAdministrativeUnitMember cmdlet in PowerShell to add a new member to an administrative unit is helpful to you.

You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.

Related Links

Get-MsolAdministrativeUnitMember

Remove-MsolAdministrativeUnitMember