< -- BuySellAds Ad Code ALLEN -->
Microsoft Logo

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.

    save query

    save 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.

    Tags: query

    Allen White

    Allen is an IT Consultant and holds the following accreditations. MCSA, MCSE, MCTS, MCITP, CCA, CCSP, VCP 4,5, 6 and HP ASE, AIS - Network Infrastructure.

    Leave a comment

Categories

Vote!

What Web Browser Do You Use?

View Results

Loading ... Loading ...

Vote!

What do you prefer..VMware or Hyper-V?

View Results

Loading ... Loading ...