Find & Remove Old Computer Accounts from Active Directory
When a workstation is removed from the network and it or a new computer is not put back on the network with the same computer name, the computer account still exists in Active Directory. These accounts should be deleted from Active Directory.
1) login to a server that has the Active Directory Users & Computers snap-in.
2) open a command prompt
3) run this command: "dsquery computer âinactive 8 â limit 0â
a. this will return a list of all computers that have been inactive for 8 weeks and "-limit 0â will return a complete list vs limiting the list to the top x computers.
4) Verify that these computers are no longer on the network
5) Remove them from Active Directory by 1 of the following methods:
a. Open the Active Directory Users & Computers snap-in, find each computer, right-click on the computer, and select delete.
b. Open a command prompt and run: "dsquery computer âinactive 8 âlimit 0 > out.txtâ Open this file in notepad and add "dsrmâ to the beginning of every line and adding "-nopromptâ to the end of every line. Save the file as a .bat file and run from the command prompt. This will create a batch file to delete all of the inactive workstations.
Article ID: 31
Created: Wed, Jun 6, 2012
Last Updated: Wed, Jun 6, 2012
Author: Natural Networks NOC
Online URL: http://kb.naturalnetworks.com/article/how-to-find-remove-old-computer-accounts-from-active-directory-31.html