Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Bulk import from a CSV file into Exch 2007 Mail Contacts

Posted on 2009-12-21
Medium Priority
Last Modified: 2012-05-08
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}
Question by:NickMeyrick
  • 2
LVL 76

Expert Comment

by:Alan Hardisty
ID: 26098323
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.
LVL 76

Accepted Solution

Alan Hardisty earned 1500 total points
ID: 26098336

Author Closing Comment

ID: 31668600
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

Featured Post

Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

Question has a verified solution.

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

Mailbox Corruption is a nightmare every Exchange DBA wishes he never has. Recovering from it can be super-hectic if not entirely futile. And though techniques like the New-MailboxRepairRequest cmdlet have been designed to help with fixing minor corr…
Exchange database can often fail to mount thereby halting the work of all users connected to it. Finding out why database isn’t mounting is crucial and getting the server back online. Stellar Phoenix Mailbox Exchange Recovery is a champion product t…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Suggested Courses

580 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