Modify SMTP Address RRS feed

  • Question

  • Hi,

    We had several users left the company and we hide their mailboxes and change their primary smtp address to This is our standard process.

    Now most of the users are returned back we need to activate their mailboxes and change the primary smtp address to what they had before they left the company e.g.

    I need to come up with a script to modify their smtp address as stated above for over 700 users. Any help will be greatly appreciated.

    I have come up with one script, but it removes all proxy address and only keeps primary smtp address i want. I want the script not to remove their other emailaddresses and just modify the one i want. We are using Exchange 2007 SP3 RU9.

    Import-CSV .\Users.csv | foreach {Set-Mailbox $ -Name $_.Name -DisplayName $_.DisplayName -Alias $_.Alias -EmailAddresses $_.mail -SamAccountName $_.SamAccountName -HiddenFromAddressListsEnabled $TRUE -EmailAddressPolicyEnable $False}


    Monday, January 14, 2013 3:53 AM


  • Hishahid,

    You can follow this to have a try:

    $mailboxes=get-mailbox -resultsize unlimited

    foreach($mailbox in $mailboxes)


       for($i=($mailbox.EmailAddresses.count)-1; $i -ge 0; $i--)

             if($addressString -like "")

    $mailbox|set-mailbox -EmailAddresses $mailbox.EmailAddresses




    Evan Liu
    TechNet Community Support

    Tuesday, January 15, 2013 12:22 PM