Skip to content

Commit

Permalink
Support to exclude KBArticleIDs in PendingUpdates
Browse files Browse the repository at this point in the history
  • Loading branch information
akunzai committed Apr 11, 2023
1 parent d46e958 commit 0f074e9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions SecureAuditor.ini
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ MinimumPasswordAge = 1
MinimumPasswordLength = 12
PasswordHistorySize = 3

[PendingUpdates]
; Regex pattern to exclude KBArticleIDs
Exclude =

[Rules]
; Regex pattern to exclude rule name
Exclude =
Expand Down
9 changes: 7 additions & 2 deletions rules/PendingUpdates.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,16 @@ function Test($config) {
$updateSession.ClientApplicationID = 'Windows Secure Auditor'
$updateSearcher = $updateSession.CreateUpdateSearcher()
$result = $updateSearcher.Search('IsHidden=0 and IsInstalled=0')
if ($result.updates.Count -eq 0) {
$exclude = $config.PendingUpdates.Exclude
$updates = $result.updates
if (-not [string]::IsNullOrWhiteSpace($exclude)) {
$updates = $updates | Where-Object { $_.KBArticleIDs -inotmatch $exclude }
}
if ($updates.Count -eq 0) {
return;
}
Write-Output "`n## $($i18n.PendingUpdates)`n"
foreach ($update in $result.updates) {
foreach ($update in $updates) {
Write-CheckList $false $update.Title
if ($update.RebootRequired) {
Write-Output " - $($i18n.RebootRequired)"
Expand Down

0 comments on commit 0f074e9

Please sign in to comment.