Solved

Export Active Directory OU

Posted on 2014-02-25
8
405 Views
Last Modified: 2014-02-25
Hello Experts,

I am attempting to export contacts of an Active Directory OU into a csv file. I've found lots of links on how to do this, but I would prefer not to install any additional software. Here is the command I am using:

Get-ADUser -Filter * -SearchBase "ou=Ou,dc=contoso,dc=com" -Properties * | Export-Csv  "c:\somefile.csv"

Unfortunately, this command exports a csv with 0 entries.

I have tried removing the -Properties * but it still exports blank.
0
Comment
Question by:zequestioner
8 Comments
 
LVL 35

Expert Comment

by:Mahesh
ID: 39886453
You can try script in below post to export OU structure

http://blog.flaphead.com/2010/09/10/powershell-to-export-ad-ou-structure/
0
 
LVL 39

Accepted Solution

by:
footech earned 500 total points
ID: 39886464
Contacts aren't users, so they wouldn't be returned by Get-ADUser.
You can try with Get-ADObject instead which will return the objects.
0
 
LVL 1

Author Comment

by:zequestioner
ID: 39886468
I would like to export the contents of the OU, which are objects with type 'Contact'.. I would like to export the name and email address of each contact in the OU.
0
 
LVL 1

Author Comment

by:zequestioner
ID: 39886471
ah, gotcha. Let me try ADObject....
0
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
LVL 1

Author Comment

by:zequestioner
ID: 39886684
I've requested that this question be closed as follows:

Accepted answer: 0 points for zequestioner's comment #a39886468

for the following reason:

Thanks!
0
 
LVL 14

Expert Comment

by:Justin Yeung
ID: 39886535
here is the answer

Get-Adobject -filter {ObjectClass -eq "contact"} -searchbase "your ou path" -properties TargetAddress | select-object Name,TargetAddress | export-csv -path "yourpath"
0
 
LVL 39

Expert Comment

by:footech
ID: 39886677
@zequestioner - It appears that you selected the wrong comment as the solution...
0
 
LVL 1

Author Closing Comment

by:zequestioner
ID: 39886685
Thanks!
0

Featured Post

Problems using Powershell and Active Directory?

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

Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
This tutorial will walk an individual through locating and launching the BEUtility application and how to execute it on the appropriate database. Log onto the server running the Backup Exec database. In a larger environment, this would generally be …
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…

895 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

11 Experts available now in Live!

Get 1:1 Help Now