Solved

need powershell script to export contacts

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Learn to move / copy / export exchange contacts to iPhone without using any software. Also see the issues in configuration of exchange with iPhone to migrate contacts.
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 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 >>…
In this video we show how to create an email address policy 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 Mail Flow…

785 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