diff --git a/Sources/Winget-AutoUpdate/Winget-Upgrade.ps1 b/Sources/Winget-AutoUpdate/Winget-Upgrade.ps1 index 752aa29..f558437 100644 --- a/Sources/Winget-AutoUpdate/Winget-Upgrade.ps1 +++ b/Sources/Winget-AutoUpdate/Winget-Upgrade.ps1 @@ -295,10 +295,9 @@ if (Test-Network) { Write-ToLog "Checking application updates on Winget Repository..." "yellow" $outdated = Get-WingetOutdatedApps - #If something unusual happened - if ($outdated -like "An unusual*") { + #If something unusual happened or no update found + if ($outdated -like "No update found.*") { Write-ToLog "$outdated" "cyan" - $outdated = $False } #Run only if $outdated is populated! diff --git a/Sources/Winget-AutoUpdate/functions/Get-WingetOutdatedApps.ps1 b/Sources/Winget-AutoUpdate/functions/Get-WingetOutdatedApps.ps1 index f683d4c..82559b4 100644 --- a/Sources/Winget-AutoUpdate/functions/Get-WingetOutdatedApps.ps1 +++ b/Sources/Winget-AutoUpdate/functions/Get-WingetOutdatedApps.ps1 @@ -9,11 +9,11 @@ function Get-WingetOutdatedApps { } #Get list of available upgrades on winget format - $upgradeResult = & $Winget upgrade --source winget | Out-String + $upgradeResult = & $Winget upgrade --source winget | Where-Object { $_ -notlike " *" } | Out-String #Start Conversion of winget format to an array. Check if "-----" exists (Winget Error Handling) if (!($upgradeResult -match "-----")) { - return "An unusual thing happened (maybe all apps are upgraded):`n$upgradeResult" + return "No update found. Winget upgrade output:`n$upgradeResult" } #Split winget output to lines