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

image
The following command will return all disabled computer account information:

dsquery computer –disabled

image

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

image 

dsquery command reference
dsrm command reference

46 comments:

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:

http://www.microsoft.com/download/en/details.aspx?id=20961

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

http://technet.microsoft.com/en-us/library/gg682041.aspx

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

Thanks Murali.

Please provide more information about requirement.

You can install software using this logic - http://portal.sivarajan.com/2010/05/installing-forefront-client-security.html
http://www.sivarajan.com/scripts/FCS_Install.txt

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,
Murali

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 https://www.adsysnet.com/asn-active-directory-inactive-account-tracker-features.aspx

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 (http://www.lepide.com/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. http://www.adaxes.com/tutorials_AutomatingDailyTasks_DeleteInactiveComputersFromActiveDirectory.htm 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 http://wizardsoft.nl/admintools/admintools.html . 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.


Thanks
Satya

Really good procedure to clean inactive computer accounts in AD environment but I found good article (http://www.esystool.com/cleanup-old-computer-accounts-in-active-directory/ ) 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.

Hi your post is really appreciatable.I really thankful for this post. Here i would llike to share some information about facebook. As we know that facebook is a social trap where we connect with people in all over world. So if you are using facebook and face any technical issue that time so just visit our website. We can resolve the smallest problem on same time. For further information please visit on our website- facebook bellen belgie

Hi thankyou for this great helpful information.this information is really useful at today's time.you had easily explained whole information in a short note. Now i would like to share some information about PayPal.So If you are a Paypal user and you are facing any problem regarding to PayPal. No need to worry just simply visit on our site- paypal email belgie

Hi your post is very nice and i am greatful to you for sharing this post with us.here i want to share some information about Norton Antivirus.As we all know how much Norton Antivirus is usefull for our laptops and mobiles.so whenever you have any query regarding Norton or need any assistance how to run or any information that time please visit over this site-Bellen norton Ondersteuning

Hi.. I read your blog which is really great and Thanks for sharing. Keep posting. Must visit on facebook bellen

Thanks for sharing it is important for me. I also searched for that from here. Visit our site Avast ondersteuning

This comment has been removed by the author.

Your blog is very informative, finally, I found exactly what I want. Paypal is an excellent service for online payments but lots of its users confront issues while they access Paypal. If you want to resolve your problems then must visit Paypal klantendienst.

Your blog is very informative and interesting to read, finally, I found exactly what I searching for. There are lots of users of Macfee antivirus in the world because of its features and easy interface. If you want to explore more interesting facts about Mcafee antivirus or want to resolve your technical issues then must visit Mcafee ondersteuning Nederland.

Hi, Thank you for sharing such a good and valuable information,It is very important for me. Gmail is the worldwide used email service but sometimes user faces some problems in it. If you want to get some information about the Gmail then you can visit Gmail-tili.

Unbelievable blog! This blog provides a brief introduction which is very helpful for me. Instagram is the most usable platform in the world because of its latest features but the user some time confronts some issues on Instagram. For more information, you can visit Instagram yhteystiedot.

Thanks for sharing it is important for me. I also searched for that from here. Visit our site Avast ondersteuning

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

The information you are providing that is really good. Thank for making and spending your precious time for this useful information. Thanks again and keep it up. https://www.akgvg.com

Post a Comment

Popular Posts

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More