Solved

need powershell script to export contacts

Posted on 2009-07-08
4
1,843 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 17

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 17

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
In previous parts of this Nano Server deployment series, we learned how to create, deploy and configure Nano Server as a Hyper-V host. In this part, we will look for a clustering option. We will create a Hyper-V cluster of 3 Nano Server host nodes w…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
This video discusses moving either the default database or any database to a new volume.

685 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