Link to home
Start Free TrialLog in
Avatar of Jerry Seinfield
Jerry SeinfieldFlag for United States of America

asked on

Bulk creation of contacts in Exchange given a CSV file

Hello Experts,

I have a request for bulk creation of contacts in Exchange given a CSV file. The CSV file has the following structure:

Displayname      Email      FirstName       LastName

is there a Exchange powershell cmdlet or script to import a CSV and create all the contacts in Exchange into a Specific OU in AD?

btw, we do have Exchange 2010 SP1 in PROD, and all our servers runs Windows server 2008 R2

Please advise
ASKER CERTIFIED SOLUTION
Avatar of Manpreet SIngh Khatra
Manpreet SIngh Khatra
Flag of India 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
Avatar of Jerry Seinfield

ASKER

Hi Randy,

i ran the command above, and got an error, as displayed on attached file

Any ideas?
ErrorImportContacts.png
here is the command i did run

Import-Csv ExchangeExternalContacts.csv | ForEach { New-MailContact -Name $_.DisplayName -Firstname $_.FirstName -LastName $_.LastName -ExternalEmailAddress $_.EmailAddress -OrganizationalUnit "OU=Contacts,OU=External Users,OU=XXX Users,DC=XXX,DC=XXX,DC=XXX,DC=XXX" }
ExternalEmailAddress - i guess its ExternalEmailAddresses

Just check this once for only 2 contacts ..... not more (First test always with only few so if issues its simple to delete)

- Rancy
ExternalEmailAddress - Do you have the data filled for this in the CSV ? as it says "because its null"

- Rancy
Hi Rancy,

I did test with only 2 users and did not work.

The original file has around 100 contacts that must be created, so the CSV file is filled wit this information

Just to clarify, I am trying to create external mail contacts, these users do not belong to my domain, and they do not have any account in our AD domain, just need the contacts created
Do you have the information for ExternalEmailAddress entered in the CSV file

- Rancy
Yes,
I did find another blog with same issue,

https://www.experts-exchange.com/questions/27801526/Create-New-MailContact-from-a-List.html

so, should I add an Alias to my command?, please check below my final cmdlet

Import-Csv "C:\ExternalContacts.csv" | ForEach { New-MailContact -Name $_.DisplayName -Firstname $_.FirstName -LastName $_.LastName -ExternalEmailAddress $_.EmailAddress -Alias $_.Alias -OrganizationalUnit "OU=XXX,OU=XXX,OU=XXX XXX,DC=XXX DC=XXX,DC=XXX,DC=XXX" }  

The .CSV file column headers are:

Displayname, First Name, Last Name, ExternalEmailAddress, Alias

What do you think?

Any other recommendations?
SOLUTION
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