Solved

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

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

Join & Write a Comment

ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
Marketers need statistics and metrics like everybody else needs oxygen. In this article we explain how to enable marketing campaign statistics for Microsoft Exchange mail.
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…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…

743 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