Adding Additional Email Bulk

IT_Admin XXXX
IT_Admin XXXX used Ask the Experts™
on
I'm trying to figure out to 'add' a secondary email address (bulk using .csv file) to users (exchange 2010) and leave the current as is (untouched and not by touching x400 and primary email address). Is this correct?

Import-CSV C:\temp\data.csv |
Foreach {Set-Mailbox -Identity $_.DistinguishedName -EmailAddress @{add=$_.AliasEmail}}

***where the CSV has:
Column A = DistinguishedName
Column B = AliasEmail
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2015
Distinguished Expert 2018

Commented:
That should work, yes. The parameter name is -EmailAddresses, not -EmailAddress though.

Author

Commented:
@Vasil - Awesome thank you. And thank you for the typo correction. Yes you are right -EmailAddresses :)

Thanks again!
IT Engineer
Distinguished Expert 2017
Commented:
Export current users primary smtp adress

Get-Mailbox -ResultSize Unlimited | select Displayname,alias, PrimarySMTPAddress |export-csv c:\temp\data.csv -nti

Open in new window



 Now edit the csv and add another header as secondary and under it add all secondary email address

Now import back using Powershell

import-Csv c:\temp\data.csv| Foreach-Object{
   $user = Get-Mailbox -Identity $_.PrimarySMTPAddress
   #add secondary
   $user.EmailAddresses+=$_.secondary
   #now set seconday as primary
   Set-Mailbox $user -PrimarySmtpAddress $_.secondary
}

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial