mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-06-30 18:12:33 -05:00
Compare commits
3 Commits
8fabebedf4
...
27a97e4650
Author | SHA1 | Date | |
---|---|---|---|
27a97e4650 | |||
dc236b9865 | |||
f9878a3472 |
@ -4,6 +4,11 @@ function Invoke-WPFUpdateMGMT {
|
||||
[switch]$All
|
||||
)
|
||||
|
||||
if ((-not $Selected -and -not $All) -or ($Selected -and $All)) {
|
||||
Write-Host "[Invoke-WPFUpdateMGMT] Use either 'Selected' or 'All' switches, used switches are: 'Selected' is $Selected, 'All' is $All" -ForegroundColor Red
|
||||
return
|
||||
}
|
||||
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" })
|
||||
|
||||
if ($All) {
|
||||
@ -33,10 +38,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" })
|
||||
|
@ -1,8 +1,9 @@
|
||||
function Invoke-WPFUpdatesScan {
|
||||
|
||||
|
||||
$sync["WPFScanUpdates"].IsEnabled = $false
|
||||
$sync["WPFUpdateSelectedInstall"].IsEnabled = $false
|
||||
$sync["WPFUpdateAllInstall"].IsEnabled = $false
|
||||
Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo"
|
||||
Invoke-WPFRunspace -DebugPreference $DebugPreference -ScriptBlock {
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" })
|
||||
# Check if the PSWindowsUpdate module is installed
|
||||
if (-not (Get-Module -ListAvailable -Name PSWindowsUpdate)) {
|
||||
try {
|
||||
@ -12,6 +13,7 @@ function Invoke-WPFUpdatesScan {
|
||||
}
|
||||
catch {
|
||||
Write-Error "Failed to install PSWindowsUpdate module: $_"
|
||||
$sync.form.Dispatcher.Invoke([action] { $sync["WPFScanUpdates"].IsEnabled = $true })
|
||||
return
|
||||
}
|
||||
}
|
||||
@ -23,6 +25,7 @@ function Invoke-WPFUpdatesScan {
|
||||
}
|
||||
catch {
|
||||
Write-Error "Failed to import PSWindowsUpdate module: $_"
|
||||
$sync.form.Dispatcher.Invoke([action] { $sync["WPFScanUpdates"].IsEnabled = $true })
|
||||
return
|
||||
}
|
||||
|
||||
@ -58,4 +61,7 @@ function Invoke-WPFUpdatesScan {
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" -overlay "warning" })
|
||||
}
|
||||
}
|
||||
$sync["WPFScanUpdates"].IsEnabled = $false
|
||||
$sync["WPFUpdateSelectedInstall"].IsEnabled = $false
|
||||
$sync["WPFUpdateAllInstall"].IsEnabled = $false
|
||||
}
|
||||
|
Reference in New Issue
Block a user