How to find and remove inactive computer accounts from active-directory

First the Adminpak for Windows Server must be installed - the latest can be found here:
http://www.microsoft.com/downloads/details.aspx?familyid=e487f885-f0c7-436a-a392-25793a25bad7&displaylang=en

Now check for computer that haven’t logged in in a period of time - the example below uses 8 weeks - from the command line enter:
dsquery computer -inactive 8 -limit 0

After reviewing this list to make sure these computers no longer exist on your network you can use the following command to find and delete them:
dsquery computer -inactive 8 -limit 0 | dsrm -noprompt

Leave a Reply