Solved

need powershell script to export contacts

Posted on 2009-07-08
4
1,829 Views
Last Modified: 2012-05-07
i need a powershell script that will export all the email addresses from the individual exchange users contacts into a text file.  

this is going to be run nightly and i cant just have the users each manually run this on their own client.  I am new to powershell and have been struggling with this for a couple days.  

thank you

0
Comment
Question by:koffea
  • 2
  • 2
4 Comments
 
LVL 16

Expert Comment

by:Learnctx
ID: 24809845
Why not just get the client to export their contacts from the client?

File > Import and Export > Export to a file > Comma Separated Values (Windows) > Choose the Contacts container > Choose an export location (users home drive for example) > Finish and export.

If you have to do it with PowerShell though you could try building on the below info (seems like a lot of effort for something that is built into the Outlook client).

$outlook = New-Object -com Outlook.Application

$contacts = $outlook.Session.GetDefaultFolder(10)

$contacts.items | Select LastNameAndFirstName

# Use "$contacts.items | fl *" to get a list of properties you want to export

Open in new window

0
 

Author Comment

by:koffea
ID: 24814192
i need nightly exports of the clients contacts for management reasons i dont fully understand.  basically they want a copy of everyones contacts daily (just he email addresses), and they dont want the end user to know about it.

so your script works on the local machine, but wont work on the exchange server directly?  Am i wrong in thinking that the mailbox holds a copy of the contacts list?  Or is there just no way to get at it?
0
 
LVL 16

Expert Comment

by:Learnctx
ID: 24819583
I was confused by what you had said about the user running it from their own client, I assumed the requirement was for the user to run it. I don't know if you can expose this information directly using PowerShell as I think the contact information is stored in their mailbox store. The only way I can see to do it is via a client connection. Though there is this Blog entry which may be of use, I haven't looked into it though.

http://gsexdev.blogspot.com/2009/04/using-ews-managed-api-with-powershell.html

0
 

Accepted Solution

by:
koffea earned 0 total points
ID: 24864227
i think i have come to the conclusion that this cant be done with 2007.  However it looks like it can be done with 2010.  Well just have to wait.
0

Featured Post

Too many email signature updates to deal with?

Do you feel like you are taking up all of your time constantly visiting users’ desks to make changes to email signatures? Wish you could manage all signatures from one central location, easily design them and deploy them quickly to users? Well, there is an easy way!

Join & Write a Comment

Disabling the Directory Sync Service Account in Office 365 will stop directory synchronization from working.
Marketers need statistics and metrics like everybody else needs oxygen. In this article we explain how to enable marketing campaign statistics for Microsoft Exchange mail.
To show how to generate a certificate request 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 Servers >> Certificates…
how to add IIS SMTP to handle application/Scanner relays into office 365.

707 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