Fixing the loop, more info
parent
638ab63164
commit
102799676a
|
@ -36,10 +36,8 @@ Function Update-App ($app) {
|
||||||
|
|
||||||
#Upgrade failed for a reason?
|
#Upgrade failed for a reason?
|
||||||
if ($PendingReboot -eq $true) {
|
if ($PendingReboot -eq $true) {
|
||||||
$FailedToUpgrade = $true
|
Write-Log "A Pending Reboot probably prohibited $($app.Id) from upgrading, now trying an install..." "Red"
|
||||||
Write-Log "A Pending Reboot probably prohibited $($app.Id) from upgrading..." "Red"
|
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
#If app failed to upgrade, run Install command
|
#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
|
& $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
|
$CheckOutdated2 = Get-WingetOutdatedApps
|
||||||
foreach ($CheckApp2 in $CheckOutdated2) {
|
foreach ($CheckApp2 in $CheckOutdated2) {
|
||||||
if ($($CheckApp2.Id) -eq $($app.Id)) {
|
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
|
$FailedToUpgrade = $true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue