Exporting Active Directory Users From A Specific OU

I am trying to find a way to export my Active Directory User accounts from specific OU's rather than just performing an entire export from the whole of Active Directory.

My goal is to be able to export the users and hopefully be able to also stat which fields I would like to export.

If anyone has experience with this that would be great, thanks for your help.
carlocAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Will SzymkowskiSenior Solution ArchitectCommented:
Pretty strightforward... Use the below command...

Import-module activedirectory
Get-Aduser -Filter * -Searchbase "OU=testou,DC=mydomain,DC=com" -properties * | select name, samaccountname | export-csv c:\testou_user_export.csv

Open in new window

Make sure that you change the -Searchbase string to the location in your AD environment.

You can also use the "get-aduser | get-member" (without quotes) to see what other properties you want to add to your export.

Thanks


Will.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MilesLoganCommented:
Powershell is the best way to go ( As I am learning from all in this forum )

You can also use this tool .
http://www.cjwdev.co.uk/Software/ADReportingTool/Info.html
0
carlocAuthor Commented:
Worked nicely, thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Active Directory

From novice to tech pro — start learning today.