New Script – Remove Domains from Exchange

I was recently faced with a problem at a customer where they needed to remove a lot of old inactive domains from Exchange users before migrating to Office 365, but the majority of users were not using Email Address Policies, and so it would have taken a long time to resolve, so I wrote a bit of PowerShell to do it for them!

PowerShell logo

The script first removes the domain from any Email Address Policies, then it will remove from any mail enabled users or mailboxes not covered by an email address policy. Once this is completed it will try to remove from Exchange completely.

The script is available from GitHub or TechNet Gallery As ever, any suggestions, bugs or other comments are always welcome!

If you have any questions, comments or suggestions please either leave a comment below, Tweet me @MikeParker365 or email me at

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s