I Need To Make A Change With My IT Support! Call (225) 706-8414

List Inactive AD Computer Accounts

You want a list of AD computer accounts that are stale/inactive.

Solution

You can do this via dsquery from a DC.

  1. Log into a DC.
  2. Open a command prompt.
  3. Run the command:
    C:> dsquery computer -inactive 60
This will give you a listing of all computer accounts that have been inactive for 60+ days.
A cool script to use:

date /t
time /t
echo.
echo Stale AD Data Report
echo.
if not exist %windir%ntds goto :NOT_DC
echo Computers, Inactive 60 Days
echo ——————————-
dsquery computer -inactive 60
echo.
echo Users, Inactive 60 Days
echo ——————————-
dsquery user -inactive 60
goto :EOF
:NOT_DC
echo This is not a DC, did not find:
echo %windir%ntds

Optionally, there is a really cool tool that is useful for this:

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

 

Concerned About Cyber Attacks?

CLICK HERE >

Want to Migrate to the Cloud?

CLICK HERE >
Office 365

Ready to Experience Microsoft Office 365?

Want the latest IT news directly in your inbox? Subscribe now!