The following command prompt commands can be used when auditing Active Directory for old computer objects.
On this pageJump to a section
Please note, if you’re using Windows XP you will need to run the follwing command first to register dsquery.
rundll32 dsquery
Remove old Computer objects – 52 weeks since last modified or used
dsquery computer -inactive 52 -limit 0 dsrm -noprompt –c
Disable old computer accounts – 6 months since last modified or used
dsquery computer -inactive 26 -limit 0 dsmod computer -disabled
List old computer accounts – 6 months since last modified or used
The following command will export the results into an Excel document at C:ADReport.csv
dsquery computer -inactive 26 -limit 0 > C:\ADReport.csv