How do I disable Inactive Active Directory User Accounts with Vbscripting?
If you are a system administrator managing an Active Directory environment and you need to disable inactive user accoutns then the following vbscript may assist:
‘Queries AD for all WIndows domain accounts inactive for 12 weeks or more and disables these accounts
dsquery user -inactive 12 | dsmod user -disabled yes
‘Queries AD for all active directory disabled accounts and moves the accounts to the OU -disabled accounts. Script will not run if the # of domain accounts exceed 100
dsquery user -disabled | dsmove “ou=Disabled Accounts,dc=example,dc=net” -safety 100
Reference the Microsoft article: http://support.microsoft.com/kb/322684 for more details on dsquery and dsmod usage.
active directory disable domain user account dsmod dsquery vbscriptactive directory disable domain user account dsmod dsquery vbscript
Filed under: vbscript


Leave a Reply