Solved

need powershell script to export contacts

Posted on 2009-07-08
4
1,845 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Windows 10 came with  a lot of built in applications, Some organisations leave them there, some will control them using GPO's. This Article is useful for those who do not want to have any applications in their image (example:me).
After hours on line I found a solution which pointed to the inherited Active Directory permissions . You have to give/allow permissions to the "Exchange trusted subsystem" for the user in the Active Directory...
In this video we show how to create a Shared Mailbox 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 >> Sha…
In this video we show how to create a Resource Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: Navigate to the Recipients >> Resources tab.: "Recipients" is our default selection …
Suggested Courses
Course of the Month5 days, 23 hours left to enroll

627 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