Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scan then delete old computer accounts in AD

Status
Not open for further replies.
Nov 15, 2006
40
US
Does anyone know of a way to query AD to find old computer accounts? In AD we have about 70 computer accounts but only 40 PCs. There are a lot of old computers that were not properly removed out of AD.

It would be nice if I had a script or tool I could run that would find accounts that haven't been used in like 6 months and just have them disabled or deleted.

Thanks!
 
Try running

dsquery computer -inactive 26

from a command line. It will return all inactive pc's in the last 26 weeks (6 months). You can pipe it to a text or csv file if you want.

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top