Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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
}
share|improve this answer

ADModify can easily accomplish this:

http://admodify.codeplex.com/

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.