Powershell to create the list of contacts from the given CSV files in the specified
$csv = Import-Csv “C:\Contacts.csv”
foreach($line in $csv)
{
New-MailContact -Name $line.DisplayName -ExternalEmailAddress $line.EmailAddress -OrganizationalUnit “Contacts” -Alias $line.Alias
}
Hi,
Can you post an example of the CVS format please.
Many thanks,
Rickb.
rick.bone@datacom.com.au
Hello Rickb,
Thanks for the post
you need to have CSV in the below mentioned format in the contacts.csv
Display name,EmailAddress,Alias
Krishna kumar,krishna.k@domain.com,Krishna.k
Below code will read csv file one by one and create the contact in the OU users.
$csv = Import-Csv “C:\Contacts.csv”
foreach($line in $csv)
{
New-MailContact -Name $line.DisplayName -ExternalEmailAddress $line.EmailAddress -OrganizationalUnit “users” -Alias $line.Alias
}
when i run the script i get Unexpected token ‘in’ in expression or statement. any thoughts
Can you please send the exact error what you are seeing ?
hi here the deal
i want to create a contact in a specifict place i have live 100 contcts to create and i got an excel sheet with first name, surname emial address and the country
how can i acheive this in exchange 2007 ?
csv must be like this:
Displayname,EmailAddress,Alias
Krishna kumar,krishna.k@domain.com,Krishna.k