Bulk import from a CSV file into Exch 2007 Mail Contacts

Posted on 2009-12-21
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 "<>"}
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 "<>" Set-Contact $_.displayName -Phone $_.Telephone}
Question by:NickMeyrick
    LVL 76

    Expert Comment

    by:Alan Hardisty
    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


    Author Closing Comment

    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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Email signatures have numerous marketing benefits. Here are 8 top reasons to turn your email signature into a marketing channel.
    Resolve Outlook connectivity issues after moving mailbox to new Exchange 2016 server
    In this video we show how to create a Distribution Group in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >>…
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    737 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

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now