Home ยป Office 365 ยป Remove-MsolAdministrativeUnitMember

Remove-MsolAdministrativeUnitMember

The Remove-MsolAdministrativeUnitMember cmdlet in PowerShell removes a member from the administrative unit in Microsoft Office 365.

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

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

In this article, we will discuss how to use the Remove-MsolAdministrativeUnitMember cmdlet in PowerShell to remove a member from the administrative unit in Office 365.

How to Remove a Member from an Administrative Unit in Office 365

To remove a member from an administrative unit in Office 365 with PowerShell, use the Remove-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]" 

# Remove a member to the administrative unit
Remove-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 Remove-MsolAdministrativeUnitMember command removes the user in $User from the administrative Unit in the $AdministrativeUnit. Both variables are identified by ObjectId.

Conclusion

I hope the above article on how to use the Remove-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

Add-MsolAdministrativeUnitMember