From 102799676ae6aeead37b7fdb6af5fb625c3daed7 Mon Sep 17 00:00:00 2001 From: GAJ-san Date: Mon, 1 Aug 2022 09:10:44 +0200 Subject: [PATCH] Fixing the loop, more info --- Winget-AutoUpdate/functions/Update-App.ps1 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Winget-AutoUpdate/functions/Update-App.ps1 b/Winget-AutoUpdate/functions/Update-App.ps1 index f4e68e8..8020b2d 100644 --- a/Winget-AutoUpdate/functions/Update-App.ps1 +++ b/Winget-AutoUpdate/functions/Update-App.ps1 @@ -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 } } - } } }