From 010185e1adcfcaf4b5132c7d51cddc6a8a43ba5d Mon Sep 17 00:00:00 2001 From: fukusuket <41001169+fukusuket@users.noreply.github.com> Date: Wed, 22 Oct 2025 23:09:02 +0900 Subject: [PATCH] fix: update WELA.ps1 to handle empty Baseline parameter and provide usage examples for configure command --- WELA.ps1 | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/WELA.ps1 b/WELA.ps1 index 24da6858..2688f4c8 100644 --- a/WELA.ps1 +++ b/WELA.ps1 @@ -1,7 +1,6 @@ param ( [string]$Cmd, [string]$OutType = "std", - [string]$Baseline = "YamatoSecurity", [bool]$Debug = $false, [switch]$Auto ) @@ -5436,6 +5435,8 @@ function ConfigureAuditSettings { exit 1 } + + $autidpolTxt = "./auditpol.txt" if (-not $debug) { Start-Process -FilePath "cmd.exe" -ArgumentList "/c chcp 437 & auditpol /get /category:* /r" -NoNewWindow -Wait -RedirectStandardOutput $autidpolTxt @@ -5811,6 +5812,9 @@ Write-Host $logo -ForegroundColor Green switch ($Cmd.ToLower()) { "audit-settings" { + if ([string]::IsNullOrEmpty($Baseline)) { + $Baseline = "YamatoSecurity" + } $validGuides = @("YamatoSecurity", "ASD", "Microsoft_Client", "Microsoft_Server") if (-not ($validGuides -contains $Baseline.ToLower())) { Write-Host "Invalid Guide specified. Valid options are: YamatoSecurity, ASD, Microsoft_Client, Microsoft_Server." @@ -5823,9 +5827,13 @@ switch ($Cmd.ToLower()) { } "configure" { - $validGuides = @("YamatoSecurity", "ASD", "Microsoft_Client", "Microsoft_Server") - if (-not ($validGuides -contains $Baseline.ToLower())) { - Write-Host "Invalid Guide specified. Valid options are: YamatoSecurity, ASD, Microsoft_Client, Microsoft_Server." + if ([string]::IsNullOrEmpty($Baseline)) { + Write-Host "You need to specify a baseline. The following baselines are available:" + Write-Host " * YamatoSecurity" + Write-Host "" + Write-Host "Examples: " + Write-Host "./WELA.ps1 configure -Baseline YamatoSecurity" + Write-Host "./WELA.ps1 configure -Baseline YamatoSecurity -Auto" break } ConfigureAuditSettings -Baseline $Baseline -Auto:$Auto