From f4419db85b55167cec764426f77057f52e10b83c Mon Sep 17 00:00:00 2001 From: Lea Droguet Date: Wed, 9 Jun 2021 12:31:47 +0000 Subject: [PATCH 1/2] add hotfixes data --- agent/winupdate.ps1 | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/agent/winupdate.ps1 b/agent/winupdate.ps1 index 5e3d13d..696315e 100644 --- a/agent/winupdate.ps1 +++ b/agent/winupdate.ps1 @@ -23,11 +23,15 @@ $Searcher = $Session.CreateUpdateSearcher() $historyCount = $Searcher.GetTotalHistoryCount() $UpdateHistory = $Searcher.QueryHistory(0, $historyCount) | Select * - +$updates = @() foreach ($Update in $UpdateHistory) { [regex]::match($Update.Title,'(KB[0-9]{6,7})').value | Where-Object {$_ -ne ""} | foreach { $op = Get-Operation($Update.Operation) $stat = Get-Status($Update.ResultCode) + if (-Not ($_ -in $updates)) { + $updates += $_ + } + $xml += "`n" $xml += "" + $_ + "`n" $xml += "" + $Update.Title + "`n" @@ -40,5 +44,20 @@ foreach ($Update in $UpdateHistory) { } } + +$hotfixes = Get-HotFix | ForEach-Object { + if ($updates -NotContains $_.HotFixID) { + $xml += "`n" + $xml += "" + $_.HotFixID + "`n" + $xml += " `n" + $xml += "" + $_.InstalledOn + "`n" + $xml += " `n" + $xml += "" + "Succeeded" + "`n" + $xml += " `n" + $xml += "" + $_.Description + "`n" + $xml += "`n" + } +} + [Console]::OutputEncoding = [System.Text.Encoding]::UTF8 [Console]::WriteLine($xml) \ No newline at end of file From cdf11bbd9b2763d05e605fc3678c7791f7754138 Mon Sep 17 00:00:00 2001 From: Lea Droguet Date: Fri, 11 Jun 2021 07:22:01 +0000 Subject: [PATCH 2/2] add title and op status for hotfixes --- agent/winupdate.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/agent/winupdate.ps1 b/agent/winupdate.ps1 index 696315e..09bed65 100644 --- a/agent/winupdate.ps1 +++ b/agent/winupdate.ps1 @@ -49,9 +49,9 @@ $hotfixes = Get-HotFix | ForEach-Object { if ($updates -NotContains $_.HotFixID) { $xml += "`n" $xml += "" + $_.HotFixID + "`n" - $xml += " `n" + $xml += "" + "HotFix" + "`n" $xml += "" + $_.InstalledOn + "`n" - $xml += " `n" + $xml += "" + "Installation" + "`n" $xml += "" + "Succeeded" + "`n" $xml += " `n" $xml += "" + $_.Description + "`n"