Link to home
Start Free TrialLog in
Avatar of Bill H
Bill H

asked on

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?
Avatar of stevegarri
stevegarri

If you are familiar with Powershell you could use this handy script to generate Excel based reports: https://gallery.technet.microsoft.com/scriptcenter/Generate-Excel-report-48c3f3b4#content
If you want user accounts that are not disabled, you could use powershell:

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

Open in new window

Avatar of Bill H

ASKER

Unfortunately, im not good with powershell lol.
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.
How detailed a report? If you just want the usernames, then...
net users /domain

Open in new window

Avatar of Bill H

ASKER

Steve, i get an error message saying "the term 'get-aduser' is not recognized"
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
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

Avatar of Bill H

ASKER

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
Avatar of Bill H

ASKER

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
dsquery user -inactive x (where x is a number of weeks since they were last active)

More information here:
http://ss64.com/nt/dsquery-user.html
NOTE: DSQUERY is a command line tool - run it in a simple command prompt on your domain controller.
ASKER CERTIFIED SOLUTION
Avatar of Will Szymkowski
Will Szymkowski
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I found really good information related to this topic from https://technet.microsoft.com/en-us/library/ee617195.aspx