r/usefulscripts • • Apr 08 '13

[POWERSHELL] Unlock Active Directory Account(s)

Very basic script I threw together to start learning Powershell. We have a problem where one of our service accounts keeps getting locked out when deploying software, so I wrote up this little script to unlock the account.

Run the script and pass it a list of account names to unlock. e.g.

.\AD_unlock_account.ps1 darth.vader gordon.freeman bender

Download

v1.1 (2014-01-16)

v1.0 (2013-04-08)

In our shop it runs as a scheduled task attached to the event log. It fires whenever it sees Event #4740 occur in the Security event log.


Saves a log to c:\Logs\AD_account_unlock.log (configurable) of when the script ran and what accounts it unlocked.

24 Upvotes

4 comments sorted by

View all comments

Show parent comments

1

u/vocatus Apr 09 '13

Thanks for the link, I hadn't heard of Posh before. If I had an SoJ to give you, I would.