$username = 'myuser' While(Get-AdUser $username).enabled){Start-Sleep -Seconds 30} Send-MailMessage -To 'admin@domain.com' -From 'YourPSscript@domain.com' -Subject "Account locked out - $username" ` -SmtpServer exchangeserver -Body "Your account $username"
About Me
My Links
Monday, October 5, 2015
Powershell Quick Script - Get emailed when a specific account is locked
Here's something quick and simple which sends you an email when an AD user account is locked out. The script just runs in a loop, polling ever 30 seconds and then finishes once the account is locked out. This requires a SMTP relay or receive connector on your exchange server to receive email.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment