Fixed multiple Winget installed versions

pull/40/head
Romain 2022-04-07 12:40:10 +02:00
parent 41b61bd4d4
commit cefdac2daa
2 changed files with 8 additions and 3 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<app>
<name>Winget-AutoUpdate (WAU)</name>
<version>1.7.0</version>
<version>1.7.1</version>
<author>Romanitho</author>
<info>https://github.com/Romanitho/Winget-AutoUpdate</info>
</app>

View File

@ -6,8 +6,13 @@ function Get-WingetOutdatedApps {
[string]$AvailableVersion
}
#Get WinGet Path
$WingetPath = (Resolve-Path "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_*_x64__8wekyb3d8bbwe").Path
#Get WinGet Path (if admin context)
$ResolveWingetPath = Resolve-Path "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_*_x64__8wekyb3d8bbwe"
if ($ResolveWingetPath){
#If multiple version, pick last one
$WingetPath = $ResolveWingetPath[-1].Path
}
#Get Winget Location in User context
if ($WingetCmd){
$Script:Winget = (Get-Command winget.exe -ErrorAction SilentlyContinue).Source