diff --git a/scripts/Common/Scripts/SoftwareManagement.ps1 b/scripts/Common/Scripts/SoftwareManagement.ps1 index deb4afea..51cb6a21 100644 --- a/scripts/Common/Scripts/SoftwareManagement.ps1 +++ b/scripts/Common/Scripts/SoftwareManagement.ps1 @@ -79,10 +79,14 @@ function Test-Command { Checks whether `winget` is working properly. #> function Test-Winget { - (Test-Command winget) -and -not ( - [System.Linq.Enumerable]::Any( - [string[]](winget source update winget), - [System.Func[string,bool]]{ param($line) $line -eq "Cancelled"; })); + (Test-Command winget) -and ( + & { + $output = winget source update winget; + + $? -and -not ([System.Linq.Enumerable]::Any( + [string[]]($output), + [System.Func[string,bool]]{ param($line) $line -eq "Cancelled"; })); + }); } <#