Update functions/public/Invoke-WPFUpdateMGMGT.ps1

Co-authored-by: CodingWonders <101426328+CodingWonders@users.noreply.github.com>
This commit is contained in:
MyDrift 2025-03-07 18:16:06 +01:00 committed by GitHub
parent f9878a3472
commit dc236b9865
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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" })