Skip to content

Instantly share code, notes, and snippets.

@normansolutions
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save normansolutions/7d245b25f86d6776c4f4 to your computer and use it in GitHub Desktop.
Save normansolutions/7d245b25f86d6776c4f4 to your computer and use it in GitHub Desktop.
PowerShell Script To Notify When User Account Has Been Locked Out
########################################################################
# Please Configure the following variables - $smtpServer and $from
# Leave the $event and $body variables as they are
$smtpServer="YOUR SMTP SERVER"
$from = "SET FROM EMAIL ADDRESS"
$event = Get-EventLog -LogName Security -InstanceId 4740 -Newest 1
$body = $event.Message + "`r`n`t" + $event.TimeGenerated
########################################################################
Send-Mailmessage -smtpServer $smtpServer -from $from -to $from -subject "Account Lockout" -body $body -priority High
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment