Solved

import in CSV mail contacts to exchange 2010 to specific OU

Posted on 2014-03-20
7
911 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Comparison of Amazon Drive, Google Drive, OneDrive

What is Best for Backup: Amazon Drive, Google Drive or MS OneDrive? In this free whitepaper we look at their performance, pricing, and platform availability to help you decide which cloud drive is right for your situation. Download and read the results of our testing for free!

 

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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

This article will help to fix the below errors for MS Exchange Server 2013 I. Certificate error "name on the security certificate is invalid or does not match the name of the site" II. Out of Office not working III. Make Internal URLs and Externa…
After seeing many questions for JRNL_WRAP_ERROR for replication failure, I thought it would be useful to write this article.
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

688 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