Files
winutil/functions/public/Invoke-WPFInstallUpgrade.ps1
T

37 lines
1.3 KiB
PowerShell
Raw Normal View History

+3
2023-03-07 12:28:00 -08:00
function Invoke-WPFInstallUpgrade {
<#
2023-10-19 17:12:55 -05:00
.SYNOPSIS
Invokes the function that upgrades all installed programs
2023-10-19 17:12:55 -05:00
+3
2023-03-07 12:28:00 -08:00
#>
if ($sync.WPFpreferChocolatey.IsChecked) {
Install-WinUtilChoco
$chocoUpgradeStatus = (Start-Process "choco" -ArgumentList "upgrade all -y" -Wait -PassThru -NoNewWindow).ExitCode
if ($chocoUpgradeStatus -eq 0) {
Write-Host "Upgrade Successful"
}
else{
Write-Host "Error Occured. Return Code: $chocoUpgradeStatus"
}
+3
2023-03-07 12:28:00 -08:00
}
else{
if((Test-WinUtilPackageManager -winget) -eq "not-installed") {
return
}
+3
2023-03-07 12:28:00 -08:00
if(Get-WinUtilInstallerProcess -Process $global:WinGetInstall) {
$msg = "[Invoke-WPFInstallUpgrade] Install process is currently running. Please check for a powershell window labeled 'Winget Install'"
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
return
}
Update-WinUtilProgramWinget
+3
2023-03-07 12:28:00 -08:00
Write-Host "==========================================="
Write-Host "-- Updates started ---"
Write-Host "-- You can close this window if desired ---"
Write-Host "==========================================="
}
}