diff --git a/Winget-AutoUpdate/functions/Get-WingetOutdatedApps.ps1 b/Winget-AutoUpdate/functions/Get-WingetOutdatedApps.ps1 index fc8a47c..fb1298c 100644 --- a/Winget-AutoUpdate/functions/Get-WingetOutdatedApps.ps1 +++ b/Winget-AutoUpdate/functions/Get-WingetOutdatedApps.ps1 @@ -14,8 +14,9 @@ function Get-WingetOutdatedApps { } #Get Winget Location in User context + $WingetCmd = Get-Command winget.exe -ErrorAction SilentlyContinue if ($WingetCmd){ - $Script:Winget = (Get-Command winget.exe -ErrorAction SilentlyContinue).Source + $Script:Winget = $WingetCmd.Source } #Get Winget Location in System context (WinGet < 1.17) elseif (Test-Path "$WingetPath\AppInstallerCLI.exe"){