Link to home
Start Free TrialLog in
Avatar of GJohn32
GJohn32Flag for United States of America

asked on

Create New-MailContact from a List

Hi everyone.

I need to create Contacts for several users  and would like to use Shell.  I'm in Exchange 2010.

The command is
Import-CSV "C:\xx\xx\xxx\Test address.csv" | Foreach{New-MailContact -Name $_.Name -ExternalEmailAddress $_.ExternalEmailAddress -Alias $_.Alias -OrganizationalUnit "xx/xx/xx"}


This is the error
Cannont bind argument to parameter 'External EmailAddress' because it is null.


The .CSV file column headers are:
Name, External Address, and Alias


I'm not sure what is causing the error.  I've checked for extra spaces, changed the header from External Address to SMTP
ASKER CERTIFIED SOLUTION
Avatar of LeeDerbyshire
LeeDerbyshire
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
By the way, the $_.ExternalEmailAddress in the command doesn't match the CSV column header you listed.
Avatar of GJohn32

ASKER

Thank you thank you Thank you

I changed the Header to ExternalEmailAddress without any spaces.

The External email address are pager numbers and I forgot to remove the dashes between the numbers.  So now the ExternalEmailAddress are displayed as 1234567890@txt.att.net.