How can I export / import all email aliases for an Exchange 2010 User Account?

6,168

I figured out the answer.

In exchange powershell ...

> $mbx = Get-Mailbox someUserName
> $mbx.EmailAddresses | where { $_.IsPrimaryAddress -eq "False" } | Export-CSV "C:\SomePath\wherever.csv"
> $mbx.EmailAddresses | where { $_.IsPrimaryAddress -eq "False" } | foreach { $mbx.EmailAddress -= $_.SmtpAddress }
> Set-Mailbox someUserName -EmailAddresses $mbx.EmailAddresses

> $mbx = Get-Mailbox theNewUser
> Import-CSV "C:\SomePath\wherever.csv" | foreach { $mbx.EmailAddresses += $._SmtpAddress }
> Set-Mailbox theNewUser -EmailAddresses $mbx.EmailAddresses

that's it :)

Of course, you might need to modify the contents of the csv file after the export and before the import.

I also had to delete all the existing email's from the someUserName so there were no duplicates in theNewUser

good luck :)

Share:
6,168

Related videos on Youtube

Chris Canal
Author by

Chris Canal

Updated on September 17, 2022

Comments

  • Chris Canal
    Chris Canal over 1 year

    I have a number of users in our 2010 Exchange server. I wish to export (into a file) all the email addresses for a particular user. Later on, I wish to be able to import all the email addresses once more into the user (lets assume all the emails to be imported do NOT exist in any user account).

    Anyone have any ideas how to do this?

    Powershell magic, anyone?

    • Ben Pilbrow
      Ben Pilbrow over 13 years
      I'm intrigued as to why you might want to do this?
    • Chris Canal
      Chris Canal over 13 years
      A user wishes to see all their email addys. next, they wish to bulk import missing ones. They can easily do this in excel, hence the export.
    • Ben Pilbrow
      Ben Pilbrow over 13 years
      Argh, I have a script that does something similar.... somewhere! I just can't find it at the minute. If I remember, I'll have a look through the SVN repo at work tomorrow to see if I can find it. I assume there's lots of aliases, so manually doing it is a no go?
    • Chris Canal
      Chris Canal over 13 years
      Correct. the first person i looked at had around 60 odd. Also sucks how I can't figure out how a user can add an alias via their OWA or Outlook -- currently they have to send admin (my team) and email request to add one.
    • Chris Canal
      Chris Canal over 13 years
      Any luck finding that script?
    • Ben Pilbrow
      Ben Pilbrow over 13 years
      Sorry, I can't find it anywhere. I must have deleted it with our Exchange 2010 migration testing VMs.
    • Chris Canal
      Chris Canal over 13 years
      FWIW, this link has some Powershell clues... forums.msexchange.org/m_1800435933/mpage_1/key_/…