Solved

import in CSV mail contacts to exchange 2010 to specific OU

Posted on 2014-03-20
7
900 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
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
Read this checklist to learn more about the 15 things you should never include in an email signature.
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 …
This video discusses moving either the default database or any database to a new volume.

773 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