ExchangeORG.net

Bulk create mail contacts based on a CSV file

Here's how you can use the Exchange management shell to bulk create mail contacts based on a CSV file.Create a CSV file with the following colums:
displayName,FirstName,LastName,Emailaddress
(If you have Swedish characters in the CSV file you have to save the file in UTF8.)
 
Use the following shell command to import and create the contacts based on the CSV file:
Import-Csv contacts.csv | ForEach { New-MailContact -Name $_.displayName -Firstname $_.Firstname -Lastname $_.Lastname -ExternalEmailAddress $_.Emailaddress -OrganizationalUnit "MyDomain.com/Contacts" }

For a complete list of parameters that you can use to create mail-enabled contacts go to:
http://technet.microsoft.com/en-us/library/bb124519.aspx

Comments

Luisfer said:

sorry..its not working. here's the error msg:

Import-Csv : Cannot process argument because the value of argument "name" is in

valid. Change the value of the "name" argument and run the operation again.

At line:1 char:11

+ Import-Csv  <<<< contacts.csv | ForEach {New-MailContact -Name $_.displayName

-Firstname $_.Firstname -Lastname $_.Lastname -ExternalEmailAddress $_.Emailad

dress -OrganizationalUnit " mydomain.net/Contacts"}

# September 13, 2007 9:46 PM