How long since a user last logged into server
IT Problem
This is one of those random commands that are very rearely usful however when they are needed they are great so if you would like to find out how long since a user last logged in or has been inactive then read on..
IT Solution
There are two ways we can do this. The quick way us..
1) At a domain controller drop to a command prompt. Then enter the below
- dsquery user -inactive <NumberOfWeeks> -limit 0 | dsget user -fn -ln -samid >>C:\inactive_users.txt
where <NumberOfWeeks> is integer number. This will output your inactive users to the defined txt file.
2) In Active Directory users and computers, right click ‘Saved Queries’, then New -> New Query.
Give the query a name then 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.
Related posts:
- Check what server holds FSMO roles – quickly..
- Installing Applications on a Windows Terminal Server
- Turn off Windows 7 User Account Control
- SBS2008 Server, Active Directory Fails, No users can connect – Trend WBS
- Create a User and Mailbox in Powershell


Tweet This
Share on Facebook
Digg This
Save to delicious
Stumble it
RSS Feed