Find and Delete Inactive Computer Accounts on a Domain

To find the inactive computer accounts of 25 weeks or more run the following command in a command prompt on your domain controller:

dsquery computer domainroot -d DOMAINNAME -inactive 25 >c:\inactive25.txt

To delete the inactive computers run the following command in a command prompt on your domain controller:

for /F %i in (‘dsquery computer domainroot -d DOMAINNAME -inactive 25′) do @dsrm %i -noprompt

Replace DOMAINNAME with the domain name of your organisation and substitute 25 with the specific number of weeks you want to check for.

  • Share/Bookmark

1 Comment

  • By Shadiaimara, April 6, 2009 @ 10:20 am

    Great site this waynestorey.com and I am really pleased to see you have what I am actually looking for here and this this post is exactly what I am interested in. I shall be pleased to become a regular visitor :)

Other Links to this Post

RSS feed for comments on this post. TrackBack URI

Leave a comment