When a user is deleted from Office 365 it goes into the recycling bin. This bin will clear about by itself every 30 days. Below are commands that will help you remove users from the Office 365 cloud, the recycling bin and more.
Scenario:
An administrator deletes a user from Office 365 and it goes into the recycling bin. However, when the user is re-created it states that it already exists. The object is corrupted and must be re-created.
Solution:
Connect to Exchange Online using the Windows Azure Powershell module.
For additional information on how to connect to Exchange Online using Powershell please click here.
Remove One User From the Cloud:
remove-msoluser –userprincipalname [email protected]
Remove One User From the Recycle Bin:
remove-msoluser –userprincipalname [email protected] -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 100000 | remove-msoluser -removefromrecyclebin -force
Remove All the Users With an Unlimited Count:
get-msoluser -maxresults unlimited | remove-msoluser –force
For more information on how to remove users from the Office 365 cloud, give the MessageOps team a call at 877-788-1617 or visit us online. For more Office 365 Tech Tips, click here.
Related blog posts
Get our updates straight to your inbox!
Sign up for our email updates to make sure you don't miss any of our new content.