Remove old domain from Exchange objects

Most companies have domains in their exchange that they aren’t actively using but keep for legacy reasons. One of my customers wanted to clear out an old domain from all objects since they started to get spam on those addresses. So there are to simple solutions:

  1. Remove the domain from AcceptedDomains
  2. Remove the domain from EmailAddressPolicy / All objects

They choose to go down road 2. They have very few EmailAddressPolicies we opted that they clean out the policies them self and I wrote a script to clean out the objects.

Remove all domain entries from proxyaddresses

Remove all domain entries from Email Address Policies

As always make sure that you test the scripts out of production / without rights and that you have a current backup 🙂

Leave a Reply