Retry installation if "upgrade" failed

#11
pull/13/head
Romain 2022-02-22 18:08:32 +01:00
parent 181d7898bc
commit d5dd6ef76f
1 changed files with 10 additions and 4 deletions

View File

@ -269,9 +269,15 @@ if (Test-Network){
Start-NotifTask $Title $Message $MessageType $Balise
#Winget upgrade
Write-Log "------ Winget - $($app.Name) Upgrade Starts ------" "Gray"
& $upgradecmd upgrade --id $($app.Id) --all --accept-package-agreements --accept-source-agreements -h | Tee-Object -file $LogFile -Append
Write-Log "----- Winget - $($app.Name) Upgrade Finished -----" "Gray"
Write-Log "########## WINGET PROCESS STARTS FOR '$($app.Name)' ##########" "Gray"
& $UpgradeCmd upgrade --id $($app.Id) --all --accept-package-agreements --accept-source-agreements -h | Tee-Object -file $LogFile -Append
$checkoutdated = Get-WingetOutdated
foreach ($checkapp in $checkoutdated){
if ($($checkapp.Id) -eq $($app.Id)) {
$FailedToUpgrade = $true
}
}
Write-Log "########## WINGET PROCESS FINISHED FOR '$($app.Name)' ##########" "Gray"
#Check installed version
$checkoutdated = Get-WingetOutdated