Solved

need powershell script to export contacts

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

MS Outlook is a world-class email client application that is mainly used for e-communication globally.  In this article, we will discuss the basic idea about MS Outlook, its advanced features, and types of MS Outlook File formats.
A brief introduction to what I consider to be the best editor for PowerShell.
In this video we show how to create a mailbox database 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 >> Data…
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…

947 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

18 Experts available now in Live!

Get 1:1 Help Now