Fixing the loop, more info

pull/136/head
GAJ-san 2022-08-01 09:10:44 +02:00
parent 638ab63164
commit 102799676a
1 changed files with 5 additions and 4 deletions

View File

@ -36,10 +36,8 @@ Function Update-App ($app) {
#Upgrade failed for a reason?
if ($PendingReboot -eq $true) {
$FailedToUpgrade = $true
Write-Log "A Pending Reboot probably prohibited $($app.Id) from upgrading..." "Red"
Write-Log "A Pending Reboot probably prohibited $($app.Id) from upgrading, now trying an install..." "Red"
}
else {
#If app failed to upgrade, run Install command
& $Winget install --id $($app.Id) --accept-package-agreements --accept-source-agreements -h | Tee-Object -file $LogFile -Append
@ -50,10 +48,13 @@ Function Update-App ($app) {
$CheckOutdated2 = Get-WingetOutdatedApps
foreach ($CheckApp2 in $CheckOutdated2) {
if ($($CheckApp2.Id) -eq $($app.Id)) {
#Upgrade failed for a reason?
if ($PendingReboot -eq $true) {
Write-Log "...a Pending Reboot probably prohibited $($app.Id) from installing too..." "Red"
}
$FailedToUpgrade = $true
}
}
}
}
}