mirror of
https://github.com/Yamato-Security/WELA.git
synced 2026-03-23 21:12:36 +01:00
fix: improve module logging path checks in WELA.ps1
This commit is contained in:
8
WELA.ps1
8
WELA.ps1
@@ -5717,7 +5717,8 @@ function ConfigureAuditSettings {
|
||||
try {
|
||||
$moduleLoggingPath = "HKLM:\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows\PowerShell\ModuleLogging\ModuleNames"
|
||||
$currentValue = "Not Set"
|
||||
if (Test-Path $moduleLoggingPath) {
|
||||
$pathExists = Test-Path $moduleLoggingPath
|
||||
if ($pathExists) {
|
||||
$prop = Get-ItemProperty -Path $moduleLoggingPath -Name "*" -ErrorAction SilentlyContinue
|
||||
if ($prop) {
|
||||
$currentValue = $prop."*"
|
||||
@@ -5739,7 +5740,10 @@ function ConfigureAuditSettings {
|
||||
}
|
||||
if ($response -eq "" -or $response -eq "Y" -or $response -eq "y")
|
||||
{
|
||||
New-Item -Path $moduleLoggingPath -Force | Out-Null
|
||||
if (-not $pathExists)
|
||||
{
|
||||
New-Item -Path $moduleLoggingPath -Force | Out-Null
|
||||
}
|
||||
Set-ItemProperty -Path $moduleLoggingPath -Name "*" -Value "*" -Type String
|
||||
Write-Host "[OK] Module logging enabled for all modules" -ForegroundColor Green
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user