Stop running Get-Command Under User

Get-Command winget.exe not always returns an installed winget
pull/445/head
Andreas Brett 2023-10-24 18:30:56 +02:00 committed by GitHub
parent 322aaa6e68
commit 92e64a145c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -18,9 +18,8 @@ Function Get-WingetCmd {
} }
}else{ }else{
#Get Winget Location in User context #Get Winget Location in User context
$WingetCmd = Get-Command winget.exe -ErrorAction SilentlyContinue if (Test-Path "$env:LocalAppData\Microsoft\WindowsApps\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\winget.exe") {
if ($WingetCmd) { $Script:Winget = "$env:LocalAppData\Microsoft\WindowsApps\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\winget.exe"
$Script:Winget = $WingetCmd.Source
} }
} }