How to export users out of Active Directory


I like to export profiles out of active directory.  I see the Export List menu selection, when I do a right mouse click, but it only exports the organizational unit (OU) that you are at, and it does not export other OU, where I have the profiles.

Also, there are profiles, accounts and security groups that I don't want, but only active accounts and accounts for employees.  

How can I do this?
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.

I believe the following addresses your needs:

Essentially you download and install the Microsoft Active Directory Administration module for PowerShell and then open it.  Then run the following commands:

Import-module ActiveDirectory

Then you can run a search for users:

Get-ADUser -Filter * -SearchBase "DC=domain,DC=name"  <- Obviously change domain name to suit your environment

There a lot of options you can use for the filtering:

Get-Help Get-ADUser -examples

The page I linked above has this information on it.  Let me know if you need further assistance

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
PBITAuthor Commented:
Get-ADUser -Filter * -SearchBase "DC=domain, DC=com" -Properties mail Export-CSV "EmailAddresses.csv"

I ran the above command, but PowerShell said the export-csv was an argument.  Can you tell me the argument that will get a CSV file?
PBITAuthor Commented:
I figured it out.

Get-ADUser -Filter * -SearchBase "DC=domain, DC=com" -Properties department, displayname, officephone, mobilephone,

title, division, emailaddress, manager | export-csv "d:\scripts\data.csv"
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.