AD – Removing computers that are inactive (Powershell)

We recently needed to remove computers in our Active Directory environment that have not connected in over 180 days. I decided to whip something up in powershell that we could run as an automated task!

Notes:
– Failsafe to make sure you enter a limit greater than 90(don’t want to delete everything by accident right?)
– Credentials are stored clear text
– Logs output to file and purges old logs based on specified time
– I have to try/catch twice nested to solve the issue of objects that are not leafs

4 comments… add one
  • clash of clans hack

    Greetings! Very useful advice in this particular article! It is the little changes which will make the greatest changes. Thanks a lot for sharing!

    • Dylan

      Not a problem! Im a huge fan of automation and building processes. Ill keep adding some of my work. Thanks for posting!

  • nhà cái dafabet

    FYI, your blog doesn’t look right in Opera.

    • Dylan

      Good to know thank you! I don’t use Opera and probably would have never checked.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.