Created
November 20, 2020 09:30
-
-
Save Cyb3rWard0g/bf189a25dfc55e3f1449f1ac6b85fd73 to your computer and use it in GitHub Desktop.
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
# Download https://github.com/OTRF/Set-AuditRule/blob/master/Set-AuditRule.ps1 | |
Import-Module .\Set-AuditRule.ps1 | |
$AuditRules = @" | |
"HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\JD";"Authenticated Users";"QueryValues";"None";"None";"Success" | |
"HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\Skew1";"Authenticated Users";"QueryValues";"None";"None";"Success" | |
"HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\GBG";"Authenticated Users";"QueryValues";"None";"None";"Success" | |
"HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\Data";"Authenticated Users";"QueryValues";"None";"None";"Success" | |
"@ | |
write-host "Enabling audit rules.." | |
$AuditRules | ConvertFrom-Csv -Delimiter ';' | ForEach-Object { | |
if(!(Test-Path $_.regKey)){ | |
Write-Host $_.regKey " does not exist.." | |
} | |
else { | |
Write-Host "Updating SACL of " $_.regKey | |
Set-AuditRule -RegistryPath $_.regKey -IdentityReference $_.identityReference -Rights $_.rights.split(",") -InheritanceFlags $_.inheritanceFlags -PropagationFlags $_.propagationFlags -AuditFlags $_.auditFlags -ErrorAction SilentlyContinue | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment