2

Is there any elegant way to remove email addresses from users using automation, Powershell or Exchange Email Address Policies? The platform in question is Exchange 2007.

I would like to modify email addresses of departed users so that their address would become DEPARTED.firstname.lastname@domain.local or something similar, removing their old firstname.lastname@domain.tld type addresses.

This article (Serverfault; Exchange 2010) suggests addresses are only addded using Email Address Policies, so i assume i'll have to use some other method. Suggestions? Elegant suggestions?

2 Answers2

1

Here's a PowerShell script to get you started:

$users = get-mailbox -OrganizationalUnit disabled

foreach ($user in $users) {
    $newaddresses = @()
    foreach ($address in $user.emailaddresses) {
        $newaddresses += "SMTP:disabled." + $address.smtpaddress
    }
    $user.emailaddresses.clear()
    foreach ($address in $newaddresses) {
        $user.emailaddresses.add($address)
    }
    set-mailbox -identity $user.identity -emailaddresses $user.emailaddresses
}
longneck
  • 23,082
  • 4
  • 52
  • 86
0

ADModify can easily accomplish this:

http://admodify.codeplex.com/

joeqwerty
  • 109,901
  • 6
  • 81
  • 172