Home » Office 365 » Remove-MsolAdministrativeUnit – Delete Administrative Units in Office 365

Remove-MsolAdministrativeUnit – Delete Administrative Units in Office 365

The Remove-MsolAdministrativeUnit cmdlet in PowerShell deletes an administrative unit from Microsoft Office 365.

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

Remove-MsolAdministrativeUnit
      -ObjectId <Guid>
      [-Force]
      [-TenantId <Guid>]
      [<CommonParameters>]

In this article, we will discuss how to use Remove-MsolAdministrativeUnit cmdlet in PowerShell to delete an administrative unit from the Azure Active Directory.

How to Remove an Administrative Unit from Office 365

To remove an administrative unit from Office 365, use the Remove-MsolAdministrativeUnit cmdlet in PowerShell with the -ObjectId parameter that specifies the unique ID of the administrative unit to remove.

# Get the Administrative Unit
$AdministrativeUnit = Get-MsolAdministrativeUnit -SearchString "East Coast"

# Delete an Administrative Unit
Remove-MsolAdministrativeUnit -ObjectId $AdministrativeUnit.ObjectId -Force

The Get-MsolAdministrativeUnit command in PowerShell gets an administrative unit that matches a search string specified by the -SearchString parameter, in this case, “East Coast” and stores the administrative unit in the $AdministrativeUnit variable.

The Remove-MsolAdministrativeUnit command in PowerShell uses the -ObjectId parameter to specify the object ID of $AdministrativeUnit. This command uses the -Force parameter that doesn’t prompt for confirmation and removes an administrative unit from Office 365.

Conclusion

I hope the above article on how to use the Remove-MsolAdministrativeUnit cmdlet in PowerShell to remove an administrative unit from Office 365 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-MsolAdministrativeUnit

New-MsolAdministrativeUnit

Set-MsolAdministrativeUnit