Solved

import in CSV mail contacts to exchange 2010 to specific OU

Posted on 2014-03-20
7
895 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

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

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Marketers need statistics and metrics like everybody else needs oxygen. In this article we explain how to enable marketing campaign statistics for Microsoft Exchange mail.
In this article, I am going to show you how to simulate a multi-site Lab environment on a single Hyper-V host. I use this method successfully in my own lab to simulate three fully routed global AD Sites on a Windows 10 Hyper-V host.
In this video we show how to create an email address policy 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 Mail Flow…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

911 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