Wednesday, March 24, 2010

Delete Stale or Inactive Computer Accounts from Active Directory

Here is an easy way to identify and delete inactive or stale computers in an Active Directory environment.  Using the dsquery command you can easily find all of the computers in the directory that have not been logged into in a given time interval or disabled.

The following command will return all computers that have been inactive or stale for 2 weeks:

dsquery computer –inactive 2

The following command will return all disabled computer account information:

dsquery computer –disabled


You can combine this output with the dsrm command to delete these objects from Active Directory

dsquery computer –inactive 2 | dsrm -noprompt
dsquery computer –disabled | dsrm -noprompt


dsquery command reference
dsrm command reference


Santhosh...Recently i'm doing assesment on sccm 2012 for my new company. Please provide me there is any download software on sccm 2012 and document for.

You can download System Center Configuration Manager 2012 Beta 2 from the following location:

You can also see some System Center Configuration Manager 2012 in the following TechNet link:

Dear Santosh,

Thanks for all your Scripts and tips which makes the admin work easy.

Please help in getting a Domain Controller GP based computer script which can be used to install MS security patches (and other softwares ) to about 400 client machines ..

Really appreciate all your posts.


Thanks Murali.

Please provide more information about requirement.

You can install software using this logic -

Hi Santosh,

We have got SCCM configured in client machines and used to get MS security patches and other software installed. Now it has ceased working and need to urgently patch near abt 500+ machies before the IT audit.Please suggest a method.

1.All the machines are added to a Domain.(Users doesn't have admin privilege)
2. Need to get all the patches installed in the respective dates.:)(Patched date should be around two days after it got released from MS)

Please help me with a GP start up script to accomplish the same.

Many Thanks,

I can also recommend a tool called netwrix inactive users tracker for this. We use this tool and it identifies/automatically deactivates all users who haven’t logged into AD for a specified number of days.

Hi Siva

I have a PDC and BDC in a same location now i want to migrate from old domain to new domain. So i want to ask how can i achieve this thing. Kindly Help

This comment has been removed by the author.

i want to do it on urgent basis. It will be gud for me if you can help me.

I would recommend ASN AD Inactive Account Tracker. Please visit

There are many third party products out there. My goal was to provide a solution using built-in options or tools. This is not a place for advertisement.

I would like to share a very prominent application named Lepide active directory cleaner ( ) that is equipped with several prominent features and helps to easily locate user accounts that are obsolete or not in use for a long time by defining accurate inactivity period.
Further, you can take appropriate action to remove, disable or move them to another OU, depends upon your requirement.

You can also do it with Adaxes. It automates the process and gives a lot of flexibility when setting things up

there's an important one that worked for me. add the -c parameter to skip errors and continue moving on!

dsquery computer -inactive 8 -limit 2000 | DSRM -subtree -noprompt -c

A GUI tool that helps with cleaning up your AD (old users, computers, user profiles, user home directories) is ADCleanup. You can check it out at . Not too expensive.

There are many third party tools available. My goal was to provide to a native and free options for systems admins!

Hi Santosh,

I gone through your blog its good and helpful.

I want small help from you...

Till now i hope you worked on multiple AD issues which are meant to be critical. Can you please let me know 5 critical issues you faced for DNS, Replication and soon and how you resolved.


Really good procedure to clean inactive computer accounts in AD environment but I found good article ( ) to cleanup inactive computer accounts and manage inactive user/computer accounts, move the accounts to another OU. It's generate reports on inactive accounts, never logged on users and real last logon details of accounts in CSV, HTML and PDF format.

في مكان ما على طول الخط ، أصبحت الروائح مكونًا من مكونات 'نظيفة' على الرغم من أن عملية تنظيف الغسيل أو أي شيء آخر يتم لإزالة التربة وأي روائح. عندما تستخدم الغسالات صابون الغسول محلي الصنع لتنظيف الملابس ، كانوا يحاولون إزالة التربة وكذلك الروائح من الأجسام والبقع. ولكن في الوقت نفسه ، قاموا بتدبيس حزم من الخزامى المجفف لأنهم أحبوا الرائحة في جذوع لجعل رائحة الملابس أفضل.
شركة النجوم لخدمات التنظيف
شركة كشف تسربات المياه بالرياض
نصائح للقضاء على الحشرات
تنظيف السجاد

Finding the best Healthcare Writing Services is not easy unless one is keen to establish a professional healthcare research paper writing service company by going through their healthcare assignment writers qualifications.

It is important for cultural studies coursework writing service students to seek Cultural Studies Writing Services from a reputable cultural studies assignment writing service provider for their cultural studies research paper services.

Law Assignment Writing Services are hard to come across for those in need of Law Research Writing Services and law essay writing services.

Finding the best biological science paper writing help and Biological Science Writing Services is not easy unless one is keen to establish a reliable biological science research paper provider & biological science coursework writing services.

If you have not had Gmail account, it will be easier to start with gmail email login

Hello your post is amazing and I like it so much it helps me to understand a lot of things which cover my curiosity and now you can visit my site: Archero Mod Apk

Really Nice Post Admin, Very helpful looking for more posts, Now I have to share some information about How To Fix “Trend Micro Troubleshooting Guide” problem. If you are going through this problem you can simply visit Trend Micro helpdesk

Thanks for sharing such an Amazing information, I Couldn't leave without reading your blog. I have read another good blog, I think you have read it too. click here AVG helpdesk

Download lucky patcher apk uptodown – latest version – Mod for Android to remove ads, make in-app purchases for free, and rewrite many apps to do what you want them to.

Post a Comment

Popular Posts


Twitter Delicious Facebook Digg Stumbleupon Favorites More