Solved

How Can I export external contacts from a specific OU in my AD into CSV?

Posted on 2014-09-30
3
599 Views
Last Modified: 2014-10-01
My objective is to export about 1500 external contacts from a specific OU in a 2012 AD into CSV,  add  email addresses to this list and import back into the same OU then use Microsofts Dirsync to synchronise the contacts into o365.
Can any one help me with a script to do this?  So far I've tried the script below to export into CSV but unable to get a column for email:
Get-ADObject -Filter 'objectClass -eq "contact"' -searchbase "OU=contactupdate,ou=centre contacts,ou=qmm staging,dc=hounslow,dc=local"  -Properties mail |select name,@{e={"$($_.memberof)"};l="Member Of"} | Export-csv  c:\scripts\E2Contacts.csv -Nti.
The result of the above scripts is shown in the attached csv file. Its missing the email column which I need to add before the import.
C--scripts-E2Contacts.csv
0
Comment
Question by:Adeola Olamide
  • 2
3 Comments
 
LVL 13

Expert Comment

by:lciprianionut
ID: 40352388
You are missing in the select statement the mail property.
0
 

Author Comment

by:Adeola Olamide
ID: 40352427
Can you show me where please lciprianionut?
0
 
LVL 13

Accepted Solution

by:
lciprianionut earned 500 total points
ID: 40353227
Get-ADObject -Filter 'objectClass -eq "contact"' -searchbase "OU=contactupdate,ou=centre contacts,ou=qmm staging,dc=hounslow,dc=local"  -Properties mail |select name,@{e={"$($_.memberof)"};l="Member Of"},mail | Export-csv  c:\scripts\E2Contacts.csv -Nti.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

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.
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…

813 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

14 Experts available now in Live!

Get 1:1 Help Now