mirror of
https://github.com/Yamato-Security/WELA.git
synced 2026-10-23 22:53:00 +02:00
Fix audit applicability, NTLM value types, and native exit verification
This commit is contained in:
1 parent
71215ab498
commit
7d2117ebba
14 files changed
+426
-40
No files matched your search
@@ -203,8 +203,16 @@ function Set-WelaEffectiveAuditPolicy {
|
||||
)
|
||||
if ($Mode -eq 'minimum' -and $Mask -eq 0) { return }
|
||||
$arguments = @(Get-WelaAuditSetArguments -Guid $Guid -Mask $Mask -Mode $Mode)
|
||||
$output = & auditpol.exe @arguments 2>&1
|
||||
if ($LASTEXITCODE -ne 0) { throw "auditpol /set failed ($LASTEXITCODE): $($output -join ' ')" }
|
||||
$command = Get-Command -Name 'auditpol.exe' -CommandType Application -ErrorAction Stop
|
||||
# Native stderr alone is not failure, including under Windows PowerShell 5.1.
|
||||
$ErrorActionPreference = 'Continue'
|
||||
$PSNativeCommandUseErrorActionPreference = $false
|
||||
$global:LASTEXITCODE = $null
|
||||
$output = @(& $command.Source @arguments 2>&1)
|
||||
$exitCode = $global:LASTEXITCODE # Snapshot before formatting diagnostics or running another command.
|
||||
if ($null -eq $exitCode -or $exitCode -ne 0) {
|
||||
throw "auditpol /set failed ($exitCode): $($output -join ' ')"
|
||||
}
|
||||
}
|
||||
|
||||
function Get-WelaHostContext {
|
||||
|
||||
Reference in new issue
Block a user