• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 903
  • Last Modified:

Bulk import from a CSV file into Exch 2007 Mail Contacts

I can import name and e-mail info but not the phone number - I assume this has to be a 2 pass operation - can anyone help me with a sample script to achieve this please?
The script immediately below achieves the basic first pass:
import-csv c:\bcbc.csv | foreach { new-mailcontact -Name $_.displayName -Firstname $_.Firstname -Lastname $_.Lastname -ExternalEmailAddress $_.EmailAddress -org "<mydomain.com/contacts>"}
But if I try to append a Set-Contact command in the same script using the command Set-Contact $_.displayName -Phone $_.Telephone}
it fails - so my unsuccessful script looks like:
import-csv c:\bcbc.csv | foreach { new-mailcontact -Name $_.displayName -Firstname $_.Firstname -Lastname $_.Lastname -ExternalEmailAddress $_.EmailAddress -org "<mydomain.com/contacts>" Set-Contact $_.displayName -Phone $_.Telephone}
0
NickMeyrick
Asked:
NickMeyrick
  • 2
1 Solution
 
Alan HardistyCo-OwnerCommented:
If you issue a 'help import-csv' command from the Exchange Shell, you will see that there is no Set-Contact option, which is why it is failing.
0
 
Alan HardistyCo-OwnerCommented:
0
 
NickMeyrickAuthor Commented:
Yes - initial commnet was a bit misleading on first read but the second post to the sample script was good and enabled me to get the import working- thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now