Hello will,
The command looks ok but the csv file is not, column names (and values) should
be seperated by a comma.
If the value has spaces in it, enclose it with quetes (e.g "value"), wrap
the ou value too (it contains comma characters which can confuse the cmdlet),
here's a sample:
displayName,FirstName,LastName,Emailaddress,OrganizationalUnit
con1,con1First,con1Last,con1@xxxxxx,"OU=Contacts,OU=Groups,OU=London,DC=city,DC=DOMAIN,DC=com"
You can verify the csv file content by watching the output of:
Import-Csv c:\csv\book1.csv
---
Shay Levy
Windows PowerShell MVP
http://blogs.microsoft.co.il/blogs/ScriptFanatic
PowerShell Toolbar:
http://tinyurl.com/PSToolbar
wg> Hi there,
wg>
wg> im pretty new to PS and im wondering if someone can help point out
wg> where i am going wrong. im trying to import a list of mail contacts
wg> that are in a CSV file in to Exchange 2007 via powershell but im
wg> having now luck. below is my command and my CSV file
wg>
wg> Import-Csv c:\csv\book1.csv | ForEach { New-MailContact -Name
wg> $_.displayName -Firstname $_.FirstName -LastName $_.LastName
wg> -ExternalEmailAddress $_.Emailaddress -OrganizationalUnit
wg> "OU=Contacts,OU=Groups,OU=London,DC=City,DC=DOMAIN,DC=com"
wg>
wg> DisplayNameFirstNameLastName EmailaddressOrganizationalUnit Ted
wg> (easons)TedSmithted.smith@xxxxxx
wg> OU=Contacts,OU=Groups,OU=London,DC=city,DC=DOMAIN,DC=com
wg>
wg> when i enter the command in to PS it just sits there and doesnt even
wg> come back with an error.
wg>
wg> im sure this is a simple problem but any help is much appreciated.
wg>
wg> thanks
wg>
wg> will
wg>