From 4c41140b7b1eaae113bae6983b7d0c5747fe17f0 Mon Sep 17 00:00:00 2001 From: Charley Wu Date: Sun, 30 Jul 2023 19:09:44 +0800 Subject: [PATCH] Simplify the Antivirus enabled status detection --- rules/Antivirus.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/Antivirus.psm1 b/rules/Antivirus.psm1 index 344b505..6dcd5d0 100644 --- a/rules/Antivirus.psm1 +++ b/rules/Antivirus.psm1 @@ -77,7 +77,7 @@ function Test($config) { Write-CheckList $false "$($i18n.UpdatedStatus): $($i18n.FailedToCheckUpdateStatus)" return } - $enabled = $products | Where-Object { ('0x{0:x}' -f $_.ProductState).SubString(3, 2) -notmatch '00|01' } | Sort-Object -Property timestamp -Descending + $enabled = $products | Where-Object { ('0x{0:x}' -f $_.ProductState).SubString(3, 2) -eq '10' } | Sort-Object -Property timestamp -Descending Write-CheckList ($enabled.Count -gt 0) "$($i18n.Installed): $($enabled[0].displayName)" if ($enabled.Count -gt 0) { $upToDate = $enabled | Where-Object { ('0x{0:x}' -f $_.ProductState).SubString(5) -eq '00' }