Find and Disable Stale User Accounts

Stale user accounts can be a big problem…even more so when they are not disabled.  I’m a firm believer that if you have an account that is not being used it should be disabled.  However depending on the size of your Active Directory that can be a daunting challenge.  Below you will find a snippet of code that will identify where user accounts are not being used for 10 weeks and then it has the ability to disable them. 

dsquery user -inactive 10 -limit 0

The 10 value is for the number of weeks an account has been inactive.  If you think you are going to have a lot of these then you may want to change your limit from 0 to something like 50 or so.

Now if you would like to disable them as well you simply add on another portion of code.  For safety reasons I prefer to run the code above first to see who is inactive and then once I’ve validated those accounts can be inactive I run the following code to disable them.

dsquery user -inactive 10 -limit 0 | dsmod user -disabled yes

Obviously the account needs to have the appropriate permissions for dsmod to work so watch out for that.  Good luck and happy hunting!

88 Comments

  1. I am very happy to read this. This is the type of manual that needs to be given and not the random misinformation that’s at the other blogs. Appreciate your sharing this greatest doc.

  2. Justina says:

    Maintain working like me for the main benefit of a lot of negative credit
    slots of America. Will surely suggest you to my friends.

    Look at my site – auto loans bad credit columbus oh (Justina)

  3. Kaylee says:

    Before choosing car refinance then you must prevent it If there is no important benefit of refinancing therefore, consider
    all these bills.

    my blog; buy a car with bad credit, Kaylee,

  4. %The stunning House defeat Friday of a three-week spending bill for the Department of Homeland Security exposed Speaker John Boehner’s weakness in the face of rebellious conservatives.

    Also visit my web page – floating shelf (http://www.hentot.com)

  5. %Just be sure you can easily reach the baskets to pull them down and put them back.

    Also visit my weblog – garage shelves

  6. Gracie says:

    RSVP for The Chicago WHIR Networking Event
    Join The WHIR and hosting & cloud market associates on June 11 for this Free Networking Event!

    My website Gracie

  7. %Krost Shelving and Racking does not cater for the Larger outlets, but additionally for the smaller businessman that runs a haberdashery, pet garage shop or hardware store.

    Check out my blog post garage shelves (master.masterlearninggroup.com)

  8. %In such garages, one will find hangers, hoops, cabinets, overhead cabinets, garage shelves, and more to keep every item in an organized way.

    my webpage: shelving ideas (http://cook.horo6aya.info/)

  9. Wilbur says:

    You can always ask the hosting support personnel about downtimes that occured.

    If they’re not convincing, then it’s time to move.

    my web site … Wilbur

  10. With InMotion Hosting’s Premium Website Home builder there’s no have to set up
    additional scripts or databases to obtain your online shop up and running.

    Here is my site; web hosting hub status

  11. Giselle says:

    However don’t let the concept of a Linux host frighten you.

    Also visit my web blog :: Giselle

  12. % Hillary Rodham Clinton emailed her staff on an iPad as well
    as a BlackBerry while secretary of state, despite her explanation she exclusively used a personal email address on a homebrew server so that she
    could carry a single device, according to.

    Have a look at my web site: floating shelves (master.Masterlearninggroup.com)

  13. Kirby says:

    With Super Micro server chassis, Intel Xeon CPUs, and Intel
    S3700s for caching, we make use of top of the line hardware throughout the board.

    Also visit my blog – Kirby

  14. I really like a lot of these Brazilian virgin http://www.aliexpress.com/store/group/Brazilian-Virgin-hair-3PCS/1036282_260411398.html. I’ve truly diverse calf muscles so certainly are a little bit tight on this your butt, though all round decent.

  15. %In that case, in this article we’re likely to go over what they are; significance of proper setting up of it, and its advantages. Are you interested in learning further about hanging Corner Shelves?

    Feel free to surf to my site – floating shelves (community.gotlandscaping.com)

  16. %The woman who maneuvers and manipulates?
    Whether you are a business woman, entrepreneur or corporate leader in training your goal of the corner office is commendable.
    The woman who gets the corner office has these top 5 traits.

    Here is my page floating shelves – http://www.huepark.com

  17. %When you decide it’s time to sort out your home, one of the easiest things you can do is throw away unused and unwanted items. Things naturally build up over the years, especially if you’ve got kids, animals, friends and family around the place.

    Also visit my web page :: floating shelf (master.masterlearninggroup.com)

  18. Wilhemina says:

    I’ve been trying to find an auto loan but could not appear to get accepted for the auto money I desired.

    Here is my web page … good interest rate for car loan with bad credit (Wilhemina)

  19. Alphonso says:

    %The latest Beige book showed that economic activity continued to expand in October and November, with employment gains widespread across districts. Consumer spending also continued to advance in most districts, aided by lower gasoline prices.

    Feel free to visit my web site … floating shelf (Alphonso)

  20. %Storage shelves designed specifically for various types of media are available in numerous sizes and shapes including wide and long or narrow and tall to accommodate any type of available space in the home or office.

    My web site; garage shelves; http://www.heywickeddating.com,

  21. Christiane says:

    Hey there! I’ve been following your blog for a long time now and finally got the courage to go ahead and give
    you a shout out from New Caney Tx! Just wanted to say keep up the good work!

    Feel free to surf to my web page – What is BioActive Raspberry?
    (Christiane)

  22. Raymond says:

    An individual is able by finding credit from institutions as Match Monetary to recover
    in just a short-time.

    Review my web blog: bad credit auto loans st.paul mn, Raymond,

  23. Bridgette says:

    After looking into a few of the blog articles on your web page, I truly appreciate your technique
    of blogging. I book-marked it to my bookmark webpage list and will be checking back in the near future.
    Please check out my website as well and
    tell me your opinion.

    Look at my homepage about.me (Bridgette)

  24. Javier says:

    Thanks , I’ve just been searching for information about this subject for ages and yours is the greatest I have came upon till now.
    However, what about the bottom line? Are you certain in regards to
    the source?

    Also visit my blog: does nootrobrain work (Javier)

  25. Mallory says:

    Please let me know if you’re looking for a writer for your blog.
    You have some really good articles and I think I would be a
    good asset. If you ever want to take some of the load
    off, I’d love to write some articles for your blog in exchange
    for a link back to mine. Please send me an e-mail if interested.
    Cheers!

    Check out my web site; supplement reviews (Mallory)

  26. Whats up very nice web site!! Man .. Beautiful .. Amazing ..
    I will bookmark your blog and take the feeds also?
    I’m happy to search out so many helpful info here within the publish, we’d like work
    out extra strategies on this regard, thanks for sharing. .
    . . . .

    My weblog supplement reviews

  27. % Naturally, sometimes a buyer can merely overlook a small-spaced and old-fashioned bathroom for that perfect location and
    very affordable expense of your home.

    Take a look at my web page: floating shelves (http://ukcydirectory.Ukcynews.com/groups/thank-you-messages-for-weddings/)

  28. Keesha says:

    %
    Here are several tips to ensure easier and safer to use and
    use your garage. It does not matter whether you own a metal
    garages, concrete garages or series of so-called garage for housing development.

    Stop by my site … shelving units [Keesha]

  29. Heya i’m for the primary time here. I came across this board and I find It truly useful &
    it helped me out a lot. I am hoping to provide
    something back and aid others like you helped me.

    Have a look at my page; homes for sale in olympia washington

  30. Customers are looking for businesses through maps on their smartphones,
    and taking advantage of all of the latest technology. At the beginning of the search engine optimisation process, your SEO company should have researched
    and discussed your critical keyword phrases with you. They think that a website is enough to increase leads.

  31. Hanna says:

    Hello there! This is my first visit to your blog!
    We are a collection of volunteers and starting a new project in a community
    in the same niche. Your blog provided us useful information to work on. You have
    done a outstanding job!

    Also visit my homepage :: raspberry ketone benefits; Hanna,

  32. Jeanett says:

    Excellent web site you have here.. It’s difficult to find good
    quality writing like yours nowadays. I really appreciate individuals like
    you! Take care!!

    Here is my page what is nootrobrain (Jeanett)

  33. dc seo says:

    So if you are interested in increasing the revenue of your online business,
    you must take the help of an SEO agency in Singapore. Then they suggest tailor-made solutions to suit your
    requirements and budget. First it analyses your business
    type and nature to thoroughly understand your niche along with your audience.

  34. Lorenza says:

    %For an inexpensive and easy alternative, consider retrofitting an existent dressing table having a storage unit put on the countertop.

    Also visit my site floating shelves – Lorenza,

  35. Oscar says:

    Oh my goodness! Amazing article dude! Many thanks, However I am going through difficulties with your RSS.
    I don’t understand why I am unable to join it. Is there anybody
    else having similar RSS issues? Anybody who knows the solution will you kindly
    respond? Thanx!!

    Here is my weblog BioActive Raspberry Ketone Ingredients (Oscar)

  36. %I have since come to learn that that wasn’t entirely true either. Most home owners who happen to have a garage probably know what it’s like to try to make sense of all the stuff in their lives in a normal garage space, only to be frustrated.

    my blog floating shelf

  37. %This can help you cut back on the amount of clutter you have and be able to achieve a much neater and organized home. Some things you will need to know are discussed below to help you in picking the right shelves for what you need.

    Feel free to surf to my homepage – garage cabinets

  38. baidu.com says:

    If so, signature loan no credit assessment is the perfect mortgage loan that allows you to fulfill any unforeseen fiscal tension? Also, know that
    you should do more than merely maximize your Individual retirement account accounts.
    Development by the Japanese govt began with 2002, and
    it is planned being fully working by The year 2013 with the 1st satellite creating in 2010.

    My website; baidu.com

  39. gowna.net says:

    %The good news is that it is not difficult to tidy up your garage and keep it well organised and neat. This article is aimed at providing some top tips for de-cluttering and reorganising your garage or tool shed.

    Feel free to visit my web site – floating shelf (gowna.net)

  40. Ben says:

    %Large floor standing bookcases and small freestanding modular shelving units or wall-hanging bookshelves, these contemporary design ideas can fit numerous offices and house interiors.

    Also visit my weblog floating shelf [Ben]

  41. dc seo says:

    The local SEO Company helps their client’s website to
    achieve high rankings in the search engines. Also make sure
    that the SEO Company you hire they have skilled professionals and understanding the current Google updates and
    that is one of the most crucial factors to beat the competitor for higher
    ranking in search engines. First it analyses your business type and nature to thoroughly understand your niche along with your audience.

  42. %It’s pointless to get up a single morning thinking I’ll decorate my dining room today. With no a strategy the experience may possibly become confusing and frustrating.

    Here is my blog post … corner shelf unit (http://www.citylinkads.com)

  43. Hi there! This post couldn’t be written any better! Looking at this article reminds
    me of my previous roommate! He always kept talking about this.
    I will send this article to him. Pretty sure he’s going to have a good read.
    I appreciate you for sharing!

    Here is my web blog: supplement review 2015

  44. Percy says:

    %The Fed’s latest Beige Book, a collection of anecdotes related to the economy in each of the Fed’s 12 regions, was released Wednesday and shows broad improvement in the economy.

    My weblog: garage shelves, Percy,

  45. %But once you organize and introduce garage storage remedies, you possibly can free of charge up far more room within your storage and maximize each inch of it for use either as storage or as operate location.

    Here is my web site :: shelving ideas (maisondemars.dothome.co.kr)

  46. %These containers may be heavy and contain bulky items, of various possible sizes. Since, warehouses are places where material is stored, shelves are made and categorized according to the goods stored in them, making them essentially easy to locate.

    Here is my webpage floating shelf – pvlab.kaist.ac.kr,

  47. Nancy says:

    Ahaa, its good conversation regarding this article at this place at this blog, I have read all that, so at this time me
    also commenting at this place.

    my website :: what is nootrobrain (Nancy)

  48. Dong says:

    Hi! This is my first visit to your blog! We are a team
    of volunteers and starting a new project in a community
    in the same niche. Your blog provided us valuable information to work on. You have done a marvellous job!

    Look into my homepage Pure Asian garcinia cambogia [Dong]

  49. %Small toilets call for creative storage options in a tiny footprint provides lots of storage and display space a painted etagere set between a pair of base sinks, In this bathroom.

    My web-site – garage storage (africatube.net)

  50. Bell says:

    After exploring a handful of the articles on your site, I truly like your way of writing a blog.
    I saved as a favorite it to my bookmark site list and will be checking
    back soon. Take a look at my web site as well and let me know what you think.

    My weblog; collegerecruiter.com – Bell

  51. Brittny says:

    Your mode of telling the whole thing in this post is genuinely
    nice, every one be able to simply be aware of it, Thanks a lot.

    Stop by my webpage: pure asian garcinia reviews, Brittny,

  52. Hi my loved one! I want to say that this article is
    amazing, great written and include approximately all vital infos.
    I would like to peer more posts like this .

    Here is my site review of pure colon detox [https://about.me]

  53. dvdtalk.ru says:

    %Want to redo her room? Do you have a teenager in your house? But before you do that, you have to clear out all the old things in her room. Do you want something that reflects her personality in her room? Well, you can actually do that.

    my weblog: corner shelf unit (dvdtalk.ru)

  54. Octavio says:

    Useful information. Fortunate me I discovered your web
    site by chance, and I’m shocked why this twist of fate did not came about earlier!
    I bookmarked it.

    my website; nootrobrain nootropics; Octavio,

  55. Concepcion says:

    %Almost any item that needs to be stored can be placed in shelves. But mostly we can find books and picture frames in the shelves. One of the main furniture items that people have been using most are the shelves.

    my blog; floating shelves (Concepcion)

  56. Dee says:

    Very great post. I simply stumbled upon your weblog and wanted
    to mention that I have truly loved surfing around
    your weblog posts. After all I will be subscribing to your rss feed
    and I am hoping you write once more very soon!

    My blog: raspberry ketone benefits; Dee,

  57. Maribel says:

    %There are some super cute notions out there, and I didn’t need to hoard them all; so I am sharing them with you! They’re only among the few shelving ideas for the workplace which we’ve detailed.

    Here is my page … garage shelves (Maribel)

  58. %You’re now viewing our boards as a guest which gives you limited access to view most discussions and access our other features.

    Here is my web-site garage storage (planejattomobile.com)

  59. What’s up, everything is going nicely here and ofcourse every one is sharing information, that’s genuinely
    excellent, keep up writing.

    My web blog bioactive raspberry ketone review

  60. %In these tough times, shops would like to seek out that delicate balance between cost-effective and engaging shopfittings, nevertheless it can be dangerously easy to go for cost-effective over engaging, and vice-versa, thus spoiling the full.

    my web page :: floating wall Shelf

  61. This blog was… how do you say it? Relevant!! Finally I have
    found something which helped me. Thanks a lot!

    My blog post – Pure Asian Garcinia

  62. This paragraph will help the internet people for creating new blog or even a blog from start
    to end.

    Here is my weblog Pure Asian Garcinia

  63. %Open any cupboard and the only thing you see is piles and piles of things piled up high on shelves. Exactly where did it all originate from?

    Here is my web page; garage shelves [http://www.meridiancollege.co.uk]

  64. Natalie says:

    Hello, Neat post. There’s an issue along with your web site in web
    explorer, may test this? IE nonetheless is the marketplace chief and a large
    part of people will omit your great writing due to
    this problem.

    Here is my homepage … garcinia cambogia health (Natalie)

  65. Carmen says:

    %It is the perfect choice for contemporary homes though it might seem a bit odd for homes where most of the dcor is done in wood. Shelves made of a variety of glasses exude an aura of sheer elegance and opulence.

    My web blog – floating shelf (Carmen)

  66. %Fuel economy will be more evident for those people who are living in chilled places as they should run the lights even at daytime. All the vehicles are equipped with a lighting system to ensure safe drive.

    Here is my blog – floating shelf (http://www.3834.co.kr)

  67. Charli says:

    %Cabinets are great in a garage. So what can you do to make them work in your garage? They make the garage look cleaner and neater since you can hide all of your things inside them. What are the best solutions available?

    Feel free to visit my web-site … corner shelf unit (Charli)

  68. Nice answer back in return of this question with firm arguments and telling the whole
    thing regarding that.

    Feel free to surf to my webpage: Raspberry Ketone Benefits

  69. %Many people can quickly become overwhelmed by the amount of ‘stuff’ that ends up inside their garage. Clutter is the nice word for the mess that ensues. But you can tidy up your garage quickly and easily with any of these organizational ideas.

    Here is my web-site :: corner shelf unit (atlantidadetectives.es)

  70. Cassandra says:

    We stumbled over here coming from a different website
    and thought I might check things out. I like what I see so i am
    just following you. Look forward to going over your web page again.

    Also visit my page; pure asian garcinia reviews (Cassandra)

  71. %Not helping matters: his frankly weird relationship with his overbearing mother. Stylishly shot, and reflecting Polish society’s conservatism, this is a coming-out tale riddled with pain and anguish.

    Also visit my webpage storage shelf

  72. dony.ru says:

    % Measure the area where you will be installing your bathtub corner shower.

    my web site … floating shelves (dony.ru)

  73. % But with the sheer volume of information available today it’s easy to get overwhelmed and quickly move
    from self help to shelf help. Humans are information collectors.

    Feel free to visit my webpage :: garage shelves, http://www.njegic.com,

  74. %This means you need to find creative storage ideas if you want to hang onto most of your things. With the economy the way it is now, many people are choosing to downsize the sizes of the homes they live in.

    my webpage … floating shelf (http://leejinki.com/?document_srl=1506619)

  75. %Consumer spending also continued to advance in most districts, aided by lower gasoline prices. The latest Beige book showed that economic activity continued to expand in October and November, with employment gains widespread across districts.

    Here is my weblog storage shelf (drupal-demo.opendover.nl)

  76. %In the back of our minds we keep thinking we will use it or need it. Our culture never throws anything at all out. From every vacation memento to our first present that our child made for us, we just can’t bear to throw it away.

    my web site: garage storage (http://www.musicofpuertorico.com)

  77. I enjoy looking through an article that can make men and women think.
    Also, thanks for allowing me to comment!

  78. %Here are a few tips for keeping your garage organized. To be or not to be a pack rat! One of the most notoriously unorganized areas of the house is undoubtedly the dreaded garage.

    my web page: shelving units (http://www.bffalert.com/groups/gondola-shelving-units/)

  79. Howdy, i read your blog from time to time and i own a similar one and i was just wondering if you get a lot of spam remarks?

    If so how do you stop it, any plugin or anything you can recommend?
    I get so much lately it’s driving me insane so any help is very much appreciated.

  80. Αn intеresting discussion іs worth cоmment. I beliege tҺɑt you oughyt to write more oon thks issue, it
    mаy not be a taboo matter bսt ցenerally people ddo not talk аbout thesе topics.
    Τо the next! Cheers!!

    mү web рage :: dubai online shopping

  81. Quand a Petit fute, je le mets a la troisieme place du podium apres
    le Routard ou le Alone.

  82. This website truly has all the information I needed about this subject
    and didn’t know who to ask.

  83. I am not sure where you are getting your info, but good topic.
    I needs to spend some time learning more or understanding more.
    Thanks for wonderful information I was looking for this info
    for my mission.

  84. Rosaura says:

    Way cool! Some very valiid points! I appreciate you
    writing this write-up plus the rest of the website
    is very good.

  85. Are you someone who avoids wearing a heavy backpack or a shoulder bag on a sightseeing tour.
    This contrast produces a strong visual effect,
    very suitable for girls and young women, giving a chic
    and dynamic appearance. These bag factories employ some
    individuals who concentrate on a particular part of handbag creating.

  86. Better still, you can buy your duffel bag online from retailers such as.
    Furthermore, they are also use to make them appear more modern and playful.
    The Same Kind Of internet may also be tailored gout arthritis, vitiligo, psoriasis, high blood pressure
    levels, unremitting sickness, to successfully stop the population formed
    psychological, virtual endorsing pretend prescription drugs.

  87. Benim kuzenim bu blogu tavsiye etmişti. Böyle ayrıntılı bilgiler sunduğunuz için teşekkür ederim. Güzel ve tamamlayıcı bir makale olmuş.
    Bence şu anda burada çok güzel bir yazı paylaştınız. Bu web sitesinin sahibine gerçekten müteşekkirim.Paylaşım için teşekkür ederim

  88. john piterson says:

    Nice article !
    Thanks for sharing this with us.
    Here is another informative stuff which summarizes to find and remove stale users and computer accounts in active directory without having interruption – https://community.spiceworks.com/how_to/125704-how-to-find-and-remove-stale-users-and-computers-in-active-directory

4 Trackbacks

Leave a comment