How do I delete a specific domain suffix from all mailbox SMTP email addresses?

orange

The following script can be used to remove old email addresses (based on a particular domain name) from all mailboxes.

IE; if you wanted to remove the SMTP address “@tms.net.au” from all users, you can use the following script in an Exchange Management Console:

 

It’s important to remember, when changing the domain name in the above script, that you must leave at least one wildcard character (*) in the query, otherwise it will fail.

orange

2 Comments How do I delete a specific domain suffix from all mailbox SMTP email addresses?

  1. Todd

    Thank you for sharing this. I recently had to prep our accounts for O365 and when the domain was initially created they set our email policy to include the @.local alias to the accounts

    All the other examples I found seemed to rely on dumping the bad domains into a CSV or manually writing down all the accounts for the suffix you want to remove. This one was the only I found that truly removed the domain suffix from all my mailboxes programmatically

    Reply

Leave a Reply

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