Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 619
  • Last Modified:

How Do I Find A List Of Users Who Have Not Logged On In X Number Of Days?

How Do I Find A List Of Users Who Have Not Logged On In X Number Of Days? We use Active Direcotry and I would like to clean old user accounts. Something wwhich exports results to a txt file would be helpful.
0
achesterman08
Asked:
achesterman08
3 Solutions
 
Chris DentPowerShell DeveloperCommented:

Perhaps the simplest option would be this:

dsquery user -inactive 8 -limit 0

The inactive interval is measured in weeks here, not days.

Otherwise, OldCmp is a golden-oldie :)

http://www.joeware.net/freetools/tools/oldcmp/index.htm

The name suggests it's for computers, but it works just as well for users. It'll produce reports in a number of different formats :)

Chris
0
 
NotVeryFatCommented:
In Active Directory, right click 'Saved Queries', then New -> New Query.

Give it a name and select the root you wish to query, click 'Define Query' and select Users tab, then select 'Days Since last logon'.

Then, when it's run, right click the completed query and export to csv or whatever you want.
0
 
Krzysztof PytkoActive Directory EngineerCommented:
on a DC in a command-line type:

dsquery user -inactive <NumberOfWeeks> -limit 0 | dsget user -fn -ln -samid >>C:\inactive_users.txt

where <NumberOfWeeks> is integer number

Regards,
Krzysztof
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now