Last active
August 29, 2019 14:50
-
-
Save robert-moses/96809e6b235af44921086016d5d183e3 to your computer and use it in GitHub Desktop.
WIndows Event Log alerting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Well Known SIDs of interest | |
# SID: S-1-5-32-544 | |
# Name: Administrators | |
# | |
# SID: S-1-5-21domain-512 | |
# Name: Domain Admins | |
# | |
# Test lockout - EventID: 4740 | |
(1..6)| %{ runas /user:DQGSOCAS4681\test1 cmd} | |
# | |
# Get Event Logs | |
# get-eventlog -log security | where-object {$_.EventID -match "^680$|^528$|^672$|^4768$|^4776$" –AND $_.UserName -notmatch 'SYSTEM|NETWORKSERVICE|LOCAL SERVICE|ANONYMOUS LOGON' –AND $_.TimeGenerated -gt [datetime]::today } | sort-object -property TimeGenerated | select-object -last 100 | Format-Table -AutoSize –Wrap | |
get-eventlog -log security | where-object {$_.EventID -match "^4740$" –AND $_.UserName -notmatch 'SYSTEM|NETWORKSERVICE|LOCAL SERVICE|ANONYMOUS LOGON' –AND $_.TimeGenerated -gt [datetime]::today } | sort-object -property TimeGenerated | select-object -last 100 | Format-Table -AutoSize –Wrap |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment