Skip to content

Instantly share code, notes, and snippets.

@minkione
Forked from staaldraad/onDC.ps1
Created May 31, 2017 07:13
Show Gist options
  • Save minkione/d0c8f478e561b3989239905f4490ad75 to your computer and use it in GitHub Desktop.
Save minkione/d0c8f478e561b3989239905f4490ad75 to your computer and use it in GitHub Desktop.
Detect Possible Ruler usage On Exchange and Domain Controller
Get-EventLog -InstanceId 4776 -LogName "Security" | ForEach-Object {
$sp = $_.message -split "`n"
$tmp = $sp | Select-String -Pattern 'RULER'
if($tmp.count -ge 1){
Write-Host "Possible Ruler usage at: " $_.TimeGenerated
$sp | Select-String -Pattern 'Logon Account:' | write-host
}
}
Get-EventLog -InstanceId 4624 -LogName "Security" | ForEach-Object {
$sp = $_.message -split "`n"
$tmp = $sp | Select-String -Pattern 'RULER'
if($tmp.count -ge 1){
Write-Host "Possible Ruler usage at: " $_.TimeGenerated
$sp | Select-String -Pattern 'New Logon:' -Context 0,3 | write-host
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment