none
How to bulk add/remove email addresses to single mailbox

    Question

  • Hi,

    I'm running Exchange 2007 SP3, and I have one mailbox that contains a lot of email addresses. I want to remove a lot of those email addresses and then add a lot of new ones.

    I have created 2 CSV files, one containing the addresses that I want to add to this mailbox, and another with the ones that I want to remove.

     

    I cannot seem to figure out how to do it with EMS.

     

    Can someone enlighten me?

    Thanks

    Thursday, February 02, 2012 2:11 AM

Answers

  • Hi Pres,

    use like this.. 

     

    To ADD:

    $user = Get-Mailbox -identity userName 

    $user.emailAddresses+="test1@domain.com","test2@domain.com","test3@domain.com","test4@domain.com" 

    Set-Mailbox $user -emailAddresses $user.emailAddresses

     

    To Remove:

    $user = Get-Mailbox -identity userName 

    $user.emailAddresses-="test1@domain.com","test2@domain.com","test3@domain.com","test4@domain.com" 

    Set-Mailbox $user -emailAddresses $user.emailAddresses

     


    Kottees : My Blog : Please mark it as an answer if it really helps you.
    Thursday, February 02, 2012 4:21 AM

All replies

  • Hi Pres,

    use like this.. 

     

    To ADD:

    $user = Get-Mailbox -identity userName 

    $user.emailAddresses+="test1@domain.com","test2@domain.com","test3@domain.com","test4@domain.com" 

    Set-Mailbox $user -emailAddresses $user.emailAddresses

     

    To Remove:

    $user = Get-Mailbox -identity userName 

    $user.emailAddresses-="test1@domain.com","test2@domain.com","test3@domain.com","test4@domain.com" 

    Set-Mailbox $user -emailAddresses $user.emailAddresses

     


    Kottees : My Blog : Please mark it as an answer if it really helps you.
    Thursday, February 02, 2012 4:21 AM
  • Thanks. I knew of that way, I just didnt know if there was an even easier way by importing the CSV and doing some kind of "foreach" statement.
    Thursday, February 02, 2012 4:12 PM
  • what about this.. i did not try in my lab.

    Import-CSV CreateRecipients.csv | foreach {

    $Temp = Get-Mailbox -identity $_.UPN
    $Temp.EmailAddresses.Add($_.Emailadres1)
    $Temp.EmailAddresses.Add($_.Emailadres2)
    $Temp.EmailAddresses.Add($_.Emailadres3)
    Set-Mailbox -Instance $Temp}

    Kottees : My Blog : Please mark it as an answer if it really helps you.
    Thursday, February 02, 2012 4:23 PM
  • How is the issue now?

    Xiu Zhang

    TechNet Community Support

    Monday, February 06, 2012 7:46 AM