A two-script Active Directory account-hygiene toolkit — CleanUp-ADUsers.ps1 for inactive user accounts and CleanUp-Workstations.ps1 for stale workstation (computer) accounts. Both follow the same inactivity-driven Report → Disable → Delete lifecycle and the same -WhatIf dry-run discipline.
ADCleanUP is a small toolkit for keeping Active Directory free of dormant objects. Both scripts share one philosophy: an inactivity-driven lifecycle that reports first, disables next, and only deletes after a grace period — with a -WhatIf dry-run that produces every report, log and audit row without changing anything, and a deep set of built-in exclusions that keep automation away from accounts that must never be touched.
CleanUp-ADUsers.ps1 handles inactive user accounts. It reports users idle past a reporting threshold, disables them once on-prem inactivity crosses the disable threshold, and deletes them only when a dual gate is satisfied — disabled long enough and genuinely inactive. It can optionally verify each candidate against Microsoft Entra ID sign-in activity before disabling, so hybrid and cloud-only authenticators are not caught by a stale on-prem timestamp. The disable date is stamped into the account’s Notes attribute, and a configurable per-account opt-out — any attribute or any group, validated against the directory at startup — lets you exempt individual accounts.
CleanUp-Workstations.ps1 is the companion script for stale workstation (computer) accounts, applying the same staged, inactivity-driven, safe-by-default cleanup to domain-joined computers whose accounts have gone dormant. Full per-script parameter details are documented in the repository.
Opens github.com/rt109048/ADCleanUP in a new tab — contains CleanUp-ADUsers.ps1 and CleanUp-Workstations.ps1
PROVIDED AS IS. Free, open-source utilities intended for experienced administrators. Always test in a non-production lab environment before running anywhere that matters. By downloading and running these scripts you accept full responsibility for the outcome — the author accepts no liability for any direct or indirect damage caused by use, misuse, or modification.
Copyright © 2026 ITC Technology
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Open to advisory, contract and permanent opportunities involving Active Directory, Entra ID, identity governance, or zero-trust programmes. The best way to reach me is by email.