Guys,
I'm trying to import a .csv file which contains a list of emails using powershell to create external mail contacts. The CSV file has the following headings with an example email address:
Name,Firstname,LastName,ExternalEmailAddress,OrganizationalUnit
simontaylor,Simon,Taylor,simon.taylor@hotmail.com,
When i run the bellow command
[PS] C:\>Import-Csv testcontacts.csv | ForEach { New-MailContact -Name $_.displayName -Firstname $_.FirstName -LastName
$_.LastName -ExternalEmailAddress $_.EmailAddress -OrganizationalUnit "emea.cbre.net/Exchange Contacts/United Kingdom" }
i get the following error
Import-Csv : Cannot process argument because the value of argument "name" is invalid. Change the value of the "name" ar
gument and run the operation again.
At line:1 char:11
+ Import-Csv <<<< testcontacts.csv | ForEach { New-MailContact -Name $_.displayName -Firstname $_.FirstName -LastName
$_.LastName -ExternalEmailAddress $_.EmailAddress -OrganizationalUnit "emea.cbre.net/Exchange Contacts/United Kingdom"
}
+ CategoryInfo : InvalidArgument: (:) [Import-Csv], PSArgumentException
+ FullyQualifiedErrorId : Argument,Microsoft.PowerShell.Commands.ImportCsvCommand
Can somebody help please