Solved

import in CSV mail contacts to exchange 2010 to specific OU

Posted on 2014-03-20
7
890 Views
Last Modified: 2014-03-24
Hello,

I am having an issue importing mail contacts to specific ou.  It works when i just do import-csv "filename"  but i need to import in to a specific OU.

IN csv file i have DisplayName, Alias,EmailAddress fields

Thank you
0
Comment
Question by:ymordkovich
  • 3
  • 3
7 Comments
 
LVL 35

Accepted Solution

by:
Joseph Daly earned 250 total points
ID: 39942306
You will want to do something similar to below.

import-csv filename.csv | foreach {new-mailcontact -name $_.csvheading1 -primarysmtpaddress $_.csvheading2 -organizationalunit distinguishednameofou}
0
 

Author Comment

by:ymordkovich
ID: 39942824
I get an error

Cannot bind argument to parameter 'Name' because it is an empty string.
    + CategoryInfo          : InvalidData: (:) [New-MailContact], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,New-MailContact
0
 
LVL 35

Expert Comment

by:Joseph Daly
ID: 39942841
Can you past your modified script. Did you change the $_.csvheading1 to the correct column name in your CSV file?
0
 

Author Comment

by:ymordkovich
ID: 39942872
import-csv .\import1.csv | foreach {new-mailcontact -displayname $_.displayname -primarysmtpaddress $_.emailaddress -organizationalunit ou=newfax,dc=borbas,dc=local}

i get this error

[PS] C:\users\Administrator\desktop>.\import.ps1
Cannot process argument transformation on parameter 'PrimarySmtpAddress'. Cannot convert null to type "Microsoft.Exchan
ge.Data.SmtpAddress".
    + CategoryInfo          : InvalidData: (:) [New-MailContact], ParameterBindin...mationException
    + FullyQualifiedErrorId : ParameterArgumentTransformationError,New-MailContact
0
 
LVL 7

Assisted Solution

by:BT15
BT15 earned 250 total points
ID: 39943042
are you sure you have a column in your csv called 'emailaddress', or that the column has values in it?

your error message is complaining that you are attempting to pass an empty value to the primarysmtpaddress parameter
0
 
LVL 35

Expert Comment

by:Joseph Daly
ID: 39943124
As BT15 stated make sure that the column names match up as well there are no extra characters in the field. The only data that should be in the column is the email address.
0
 

Author Closing Comment

by:ymordkovich
ID: 39950274
Thank you all
0

Join & Write a Comment

In this article, we will see the basic design consideration while designing a Multi-tenant web application in a simple manner. Though, many frameworks are available in the market to develop a multi - tenant application, but do they provide data, cod…
Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
In this video we show how to create a Distribution Group in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >>…
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now