From cefdac2daa336ed42ca67f1802b4681ca9f6a1a1 Mon Sep 17 00:00:00 2001
From: Romain <96626929+Romanitho@users.noreply.github.com>
Date: Thu, 7 Apr 2022 12:40:10 +0200
Subject: [PATCH 1/2] Fixed multiple Winget installed versions
---
Winget-AutoUpdate/config/about.xml | 2 +-
Winget-AutoUpdate/functions/Get-WingetOutdatedApps.ps1 | 9 +++++++--
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/Winget-AutoUpdate/config/about.xml b/Winget-AutoUpdate/config/about.xml
index c5291b8..41d6e41 100644
--- a/Winget-AutoUpdate/config/about.xml
+++ b/Winget-AutoUpdate/config/about.xml
@@ -1,7 +1,7 @@
Winget-AutoUpdate (WAU)
- 1.7.0
+ 1.7.1
Romanitho
https://github.com/Romanitho/Winget-AutoUpdate
diff --git a/Winget-AutoUpdate/functions/Get-WingetOutdatedApps.ps1 b/Winget-AutoUpdate/functions/Get-WingetOutdatedApps.ps1
index 2817235..fc8a47c 100644
--- a/Winget-AutoUpdate/functions/Get-WingetOutdatedApps.ps1
+++ b/Winget-AutoUpdate/functions/Get-WingetOutdatedApps.ps1
@@ -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
From e352be6934fdf19fb82a7b2047cd8afc81976fa8 Mon Sep 17 00:00:00 2001
From: Romain <96626929+Romanitho@users.noreply.github.com>
Date: Thu, 7 Apr 2022 12:40:51 +0200
Subject: [PATCH 2/2] 1.7.1
---
Winget-AutoUpdate/config/about.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Winget-AutoUpdate/config/about.xml b/Winget-AutoUpdate/config/about.xml
index 41d6e41..f10bfda 100644
--- a/Winget-AutoUpdate/config/about.xml
+++ b/Winget-AutoUpdate/config/about.xml
@@ -4,4 +4,4 @@
1.7.1
Romanitho
https://github.com/Romanitho/Winget-AutoUpdate
-
+
\ No newline at end of file