diff --git a/scripts/Common/Scripts/SoftwareManagement.ps1 b/scripts/Common/Scripts/SoftwareManagement.ps1 index 7cf6da06..8f781a63 100644 --- a/scripts/Common/Scripts/SoftwareManagement.ps1 +++ b/scripts/Common/Scripts/SoftwareManagement.ps1 @@ -78,10 +78,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"; })); + }); } <#