Skip to content

Fix potential error when multiple AppInstaller versions installed and add explicit machine scope to Test-WinGetApp#11

Open
Skorfulose wants to merge 2 commits intobyteben:mainfrom
Skorfulose:patch-1
Open

Fix potential error when multiple AppInstaller versions installed and add explicit machine scope to Test-WinGetApp#11
Skorfulose wants to merge 2 commits intobyteben:mainfrom
Skorfulose:patch-1

Conversation

@Skorfulose
Copy link

This PR includes two things I found during testing in our corp environment:

  • We have multiuser machines, where sometimes many outdated versions of apps stick around, because previous users never log in again. In this case, the previous logic of just sorting all AppInstaller InstallLocations lexicographically descending does not lead to the desired result. Lexicographically, 1.4.3161.0 is higher than 1.21.2721.0. Version-wise, this is of course false.
  • I found that the winget.exe list in Test-WinGetApp function is not working as expected, without explicitly setting the 'scope' to 'machine'. This fixes Reset-Appx: Function Test-WinGetApp should use system context #10

Previously, Microsoft.DesktopAppInstaller packages where alphabetically sorted descending to find the latest one. This led to wrong results, e.g. in this case:
C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.4.3161.0_x64__8wekyb3d8bbwe
C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.21.2721.0_x64__8wekyb3d8bbwe
C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.16.12653.0_x64__8wekyb3d8bbwe
Without explicitly specifying the scope to the winget list command, it will query the user scope. We want it to query the machine scope of course.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reset-Appx: Function Test-WinGetApp should use system context

1 participant