Removing an Address from the Email address Policy doesn’t remove it from the users.


In Exchange if you delete an address policy or policy entry  it will not remove the address from the users themselves.(this is by design)

This is not an issue if you just modify the address (that will get re-stamped with the modified address)

 

But if you want to remove already stamped addresses from all users in a domain here is the PS command.(2010 and 2007)

    • get-mailbox |% {$a = $_.emailaddresses; $b = $_.emailaddresses; foreach ($e in $a) {if ($e.tostring() -match "DomainIWantToRemove.com") {$b -= $e;}}$_ | set-mailbox -emailaddresses $b}

image

Thanks Michael for the script.

9 thoughts on “Removing an Address from the Email address Policy doesn’t remove it from the users.

  1. Hi, I receive this error when trying
    Pipeline not executed because a pipeline is already executing. Pipelines cannot be executed concurrently.
    + CategoryInfo : OperationStopped: (Microsoft.Power…tHelperRunspace:ExecutionCmdletHelperRunspace) [],
    PSInvalidOperationException
    + FullyQualifiedErrorId : RemotePipelineExecutionFailed

  2. But this worked:

    $allmailboxes = get-mailbox
    $allmailboxes |% {$a = $_.emailaddresses; $b = $_.emailaddresses; foreach ($e in $a) {if ($e.tostring() -match “DomainIWantToRemove.be”) {$b -= $e;}}$_ | set-mailbox -emailaddresses $b}

    now looking for a way to remove %g.%s@newdomain.be and %m@newdomain.be as the customer wants only %g.%2s@newdomain.be

    If I find it I’ll post it here, or if you know please post as well. thanks

    • Easiest way would be to script removal of everything for that domain then add the one you want to the address policy and apply, I have a script to remove existing addresses. I will post when back at my pc

    • You might want to use

      $allmailboxes = get-mailbox -ResultSet unlimited

      if you have more than 1000 mailboxes in your environment.

  3. Pingback: Exchange 2010 email address policy | about:email

  4. Pingback: Exchange 2010 email address policy « prgmr.io

  5. Thanks for sharing, Jedi. I was able to start on this and update it for cleaning up invalid emails created (via email policies) for MailContacts and DistributionGroups as well. Let me know if any one needs it.

Leave a comment