Remove synced or CloudOnly Office 365 user

To remove a sync or cloud only user from Office 365:

Remove Cloud only User
remove-msoluser –userprincipalname user@dagfriden.se

If the user is syned from OnPrem Active Directory remove the user from the sync scope or delete the user from the Active Directory.

Remove One User From The Recycle Bin:
Get-MsolUser -All -ReturnDeletedUsers | select-object UserPrincipalName,ObjectID
remove-msoluser –ObjectID OID -RemoveFromRecyclebin

Remove All the Users From the Cloud:
get-msoluser | remove-msoluser -force

Remove All the Users From the Recycle Bin:
get-msoluser –returndeletedusers -maxresults unlimited | remove-msoluser -removefromrecyclebin -force

 

More info can be found at:
https://technet.microsoft.com/en-us/library/mt628068.aspx

 

Leave a Reply

Your email address will not be published. Required fields are marked *