Merge pull request #37 from Romanitho/dev

Minor changes
pull/38/head
Romain 2022-04-05 12:07:50 +02:00 committed by GitHub
commit 8efc279a66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 11 deletions

View File

@ -6,22 +6,23 @@ function Get-WingetOutdatedApps {
[string]$AvailableVersion [string]$AvailableVersion
} }
#Get WinGet Location #Get WinGet Path
$WingetCmd = Get-Command winget.exe -ErrorAction SilentlyContinue $WingetPath = (Resolve-Path "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_*_x64__8wekyb3d8bbwe").Path
#Get Winget Location in User context
if ($WingetCmd){ if ($WingetCmd){
$script:upgradecmd = $WingetCmd.Source $Script:winget = (Get-Command winget.exe -ErrorAction SilentlyContinue).Source
} }
elseif (Test-Path "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_*_x64__8wekyb3d8bbwe\AppInstallerCLI.exe"){ #Get Winget Location in System context (WinGet < 1.17)
#WinGet < 1.17 elseif (Test-Path "$WingetPath\AppInstallerCLI.exe"){
$script:upgradecmd = Resolve-Path "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_*_x64__8wekyb3d8bbwe\AppInstallerCLI.exe" | Select-Object -ExpandProperty Path $Script:winget = "$WingetPath\AppInstallerCLI.exe"
} }
elseif (Test-Path "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_*_x64__8wekyb3d8bbwe\winget.exe"){ #Get Winget Location in System context (WinGet > 1.17)
#WinGet > 1.17 elseif (Test-Path "$WingetPath\winget.exe"){
$script:upgradecmd = Resolve-Path "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_*_x64__8wekyb3d8bbwe\winget.exe" | Select-Object -ExpandProperty Path $Script:winget = "$WingetPath\winget.exe"
} }
else{ else{
Write-Log "Winget not installed !" Write-Log "Winget not installed !" "Red"
return break
} }
#Run winget to list apps and accept source agrements (necessary on first run) #Run winget to list apps and accept source agrements (necessary on first run)