To a Domain from an abandoned Office 365 tenant

I seen my fare share of customers trying to remove their domain from Office 365 either because the domain is no longer needed on the tenant

or because they are abandoning the tenant to add this domain in a new or different office 365 tenant.

Below I have the 3 powershell commands which will go ahead and remove any dependencies that may keep the domain stuck on the tenant.

*The PowerShell commands below were run in most cases after performing the required data backup on the users that are about to be removed*

We are not responsible for data loss the commands below will wipe out forever the contacts, groups and users from your tenant permanently!

To remove all unlicensed users from Office 365…

Get-MsolUser -All -UnlicensedUsersOnly | Remove-MsolUser -Force

To remove all contacts from Office 365…

Get-MsolContact -All | Remove-MsolContact -Force

To remove all groups from Office 365…

Get-MsolGroup -All | Remove-MsolGroup -Force

To Remove the domain after all the above has been cleaned up:

Remove-MsolDomain -DomainName “contoso.com” -Force

Leave a Reply

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