diff --git a/WELA.ps1 b/WELA.ps1 index 7a5d0019..376431cb 100644 --- a/WELA.ps1 +++ b/WELA.ps1 @@ -58,12 +58,24 @@ function Set-Applicable { function Get-RuleCounts { param ($rules) - $rules | Group-Object -Property level | ForEach-Object { + $levels = @("critical", "high", "medium", "low", "informational") + $counts = $rules | Group-Object -Property level | ForEach-Object { [PSCustomObject]@{ Level = $_.Name Count = $_.Count } } + + foreach ($level in $levels) { + if (-not ($counts | Where-Object { $_.Level -eq $level })) { + $counts += [PSCustomObject]@{ + Level = $level + Count = 0 + } + } + } + + return $counts } function CalculateUsableRate {