Solved

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

Posted on 2014-09-30
3
568 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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

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.
Read this checklist to learn more about the 15 things you should never include in an email signature.
In this video we show how to create a Contact 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 >> Contact ta…
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…

930 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

12 Experts available now in Live!

Get 1:1 Help Now