Solved

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

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Auditing domain password hashes is a commonly overlooked but critical requirement to ensuring secure passwords practices are followed. Methods exist to extract hashes directly for a live domain however this article describes a process to extract u…
Check out this step-by-step guide for using the newly updated Experts Exchange mobile app—released on May 30.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Suggested Courses

623 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