Fixes and minor changes

pull/688/head
Romain 2024-09-04 15:11:48 +02:00
parent 697811fed1
commit 0506eb7fa6
2 changed files with 60 additions and 55 deletions

View File

@ -299,9 +299,8 @@ if (Test-Network) {
if ($outdated -like "No update found.*") { if ($outdated -like "No update found.*") {
Write-ToLog "$outdated" "cyan" Write-ToLog "$outdated" "cyan"
} }
#Run only if $outdated is populated! #Run only if $outdated is populated!
if ($outdated) { else {
#Log list of app to update #Log list of app to update
foreach ($app in $outdated) { foreach ($app in $outdated) {
#List available updates #List available updates

View File

@ -13,8 +13,11 @@ function Get-WingetOutdatedApps {
#Start Conversion of winget format to an array. Check if "-----" exists (Winget Error Handling) #Start Conversion of winget format to an array. Check if "-----" exists (Winget Error Handling)
if (!($upgradeResult -match "-----")) { if (!($upgradeResult -match "-----")) {
return "No update found. Winget upgrade output:`n$upgradeResult"
return "No update found. 'Winget upgrade' output:`n$upgradeResult"
} }
else {
#Split winget output to lines #Split winget output to lines
$lines = $upgradeResult.Split([Environment]::NewLine) | Where-Object { $_ } $lines = $upgradeResult.Split([Environment]::NewLine) | Where-Object { $_ }
@ -73,4 +76,7 @@ function Get-WingetOutdatedApps {
} }
return $upgradeList | Sort-Object { Get-Random } return $upgradeList | Sort-Object { Get-Random }
}
} }