Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2014-09-30
3
Medium Priority
?
854 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 2000 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
There can be many situations demanding the conversion of Outlook OST files to PST format and as such, there is no shortage of automated tools to perform this conversion. However, what makes Stellar OST to PST converter stand above the rest? Let us e…
how to add IIS SMTP to handle application/Scanner relays into office 365.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Suggested Courses

876 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