From cfc7a3aa2dea24fab5619b2d1e66baf8f266e6e7 Mon Sep 17 00:00:00 2001 From: Stuart Pearson <1926002+stuartp44@users.noreply.github.com> Date: Fri, 15 Dec 2023 10:03:28 +0100 Subject: [PATCH 1/2] Add condition to check for duplicate queued updates This commit helps the occurence of duplicate Windows Update's getting queued --- update/windows-update.ps1 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/update/windows-update.ps1 b/update/windows-update.ps1 index aca6543..0ed3e47 100644 --- a/update/windows-update.ps1 +++ b/update/windows-update.ps1 @@ -201,6 +201,11 @@ for ($i = 0; $i -lt $searchResult.Updates.Count; ++$i) { Write-Output "Warning The update '$updateTitle' has the CanRequestUserInput flag set (if the install hangs, you might need to exclude it with the filter 'exclude:`$_.InstallationBehavior.CanRequestUserInput' or 'exclude:`$_.Title -like '*$updateTitle*'')" } + if (($updatesToInstall | Select-Object -ExpandProperty Title) -contains $updateTitle) { + Write-Output "Warning, The update '$updateTitle' has already been found, cannot add the same update again! Skipping." + continue + } + Write-Output "Found $updateSummary" $update.AcceptEula() | Out-Null From db8b1d37cc3bb1c8154884d6fb5574430e898507 Mon Sep 17 00:00:00 2001 From: Stuart Pearson <1926002+stuartp44@users.noreply.github.com> Date: Fri, 15 Dec 2023 10:58:46 +0100 Subject: [PATCH 2/2] Reworded warning message This PR rewords warning message in accordance to review comments. --- update/windows-update.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update/windows-update.ps1 b/update/windows-update.ps1 index 0ed3e47..5ed026d 100644 --- a/update/windows-update.ps1 +++ b/update/windows-update.ps1 @@ -202,7 +202,7 @@ for ($i = 0; $i -lt $searchResult.Updates.Count; ++$i) { } if (($updatesToInstall | Select-Object -ExpandProperty Title) -contains $updateTitle) { - Write-Output "Warning, The update '$updateTitle' has already been found, cannot add the same update again! Skipping." + Write-Output "Warning, Skipping queueing the duplicated titled update '$updateTitle'." continue }