Find active users in Active Directory

Hey guys,

I am trying to generate a report that shows the current users in Active Directory. How can i do this?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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.

If you are familiar with Powershell you could use this handy script to generate Excel based reports:
Steve WhitcherSystems AdministratorCommented:
If you want user accounts that are not disabled, you could use powershell:

get-aduser | where {$_.enabled -eq $true} 

Open in new window

Cobra25Author Commented:
Unfortunately, im not good with powershell lol.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Steve WhitcherSystems AdministratorCommented:
The one line script I provided should give you what you want.  just open powershell on your DC and paste that in.  Or, even better, add the command to export the data to CSV file automatically.

get-aduser | where {$_.enabled -eq $true} | export-csv $env:homepath

Open in new window

That should create a csv file in the c:\users\%username% folder.
NVITEnd-user supportCommented:
How detailed a report? If you just want the usernames, then...
net users /domain

Open in new window

Cobra25Author Commented:
Steve, i get an error message saying "the term 'get-aduser' is not recognized"
I found this, maybe this would help:
Make sure you are in powershell. If you are in command prompt type in powershell. Put that script in a directory you can remember and run from Powershell
Steve WhitcherSystems AdministratorCommented:
You need to run that in powershell on a domain controller.  Depending on the OS and powershell version, you might also have to import the module first:

import-module activedirectory
get-aduser -filter *| where {$_.enabled -eq $true} | export-csv $env:homepath

Open in new window

Cobra25Author Commented:
Steve, i am logged into a DC as domain admin and the export to the c:\users\ path is denied.

I ran powershell as admin
You'll need to export to the user folder you are logged in as. Change your -Path to c:\users\(your logged in user\desktop or something of the sorts
Cobra25Author Commented:
stevegarri, do you have the script for that?
Unfortunately not, try that other free tool I posted above. It may be easier for you to use
Lee W, MVPTechnology and Business Process AdvisorCommented:
dsquery user -inactive x (where x is a number of weeks since they were last active)

More information here:
Lee W, MVPTechnology and Business Process AdvisorCommented:
NOTE: DSQUERY is a command line tool - run it in a simple command prompt on your domain controller.
Will SzymkowskiSenior Solution ArchitectCommented:
What is so hard about this?

Import-module activedirectory
Get-ADuser -Filter * -Properties Name, sAMAccountName, Enabled | select Name, sAMAccountName, Enabled | Export-csv "c:\aduserexport.csv" -NoTypeInformation

Open in new window

You do not need to run this from the Domain Controller. You can run it from your workstation. However, you will require RSAT (Remote Server Admin Tools) to be installed on your machine first.

The script above will export all of your AD users to a CSV showing Name, sAMAccountName and if the account is Enabled.


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
Alan MichaelCommented:
I found really good information related to this topic from
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.