From dc236b9865a2f9b8b187560e66c2e92a37f4171a Mon Sep 17 00:00:00 2001 From: MyDrift Date: Fri, 7 Mar 2025 18:16:06 +0100 Subject: [PATCH] Update functions/public/Invoke-WPFUpdateMGMGT.ps1 Co-authored-by: CodingWonders <101426328+CodingWonders@users.noreply.github.com> --- functions/public/Invoke-WPFUpdateMGMGT.ps1 | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/functions/public/Invoke-WPFUpdateMGMGT.ps1 b/functions/public/Invoke-WPFUpdateMGMGT.ps1 index 8ec56047..072879f7 100644 --- a/functions/public/Invoke-WPFUpdateMGMGT.ps1 +++ b/functions/public/Invoke-WPFUpdateMGMGT.ps1 @@ -33,10 +33,18 @@ function Invoke-WPFUpdateMGMT { param ($selectedUpdates, $WPFUpdateVerbose) foreach ($update in $selectedUpdates) { Write-Host "Installing update $($update.Title) on $($update.ComputerName)" - if ($WPFUpdateVerbose) { - Get-WindowsUpdate -ComputerName $update.ComputerName -Title $update.Title -Install -Confirm:$false -Verbose -IgnoreReboot:$true -IgnoreRebootRequired:$true + if ($update.KB -ne "") { + if ($WPFUpdateVerbose) { + Get-WindowsUpdate -ComputerName $update.ComputerName -KBArticleID $update.KB -Install -Confirm:$false -Verbose -IgnoreReboot:$true -IgnoreRebootRequired:$true + } else { + Get-WindowsUpdate -ComputerName $update.ComputerName -KBArticleID $update.KB -Install -Confirm:$false -IgnoreReboot:$true -IgnoreRebootRequired:$true + } } else { - Get-WindowsUpdate -ComputerName $update.ComputerName -Title $update.Title -Install -Confirm:$false -IgnoreReboot:$true -IgnoreRebootRequired:$true + if ($WPFUpdateVerbose) { + Get-WindowsUpdate -ComputerName $update.ComputerName -Title "$($update.Title)" -Install -Confirm:$false -Verbose -IgnoreReboot:$true -IgnoreRebootRequired:$true + } else { + Get-WindowsUpdate -ComputerName $update.ComputerName -Title "$($update.Title)" -Install -Confirm:$false -IgnoreReboot:$true -IgnoreRebootRequired:$true + } } } $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "None" -overlay "checkmark" })