Skip to content

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

@Skorfulose

Description

@Skorfulose

Hi Ben and all,

I am currently testing your superb script. My intent is to move some thousands existing systems with Company Portal user context installs to system context installs.
Maybe I am mistaken and get the script logic wrong. But I am wondering why the Test-WinGetApp function does not use the --scope machine parameter for its winget.exe calls? Without it, it defaults to the user scope. Which leads to an unnecessary call of the Install-WinGetApp function (with its explicit machine scope).

For me, when executing manually as SYSTEM (via psexec)...
...without explicit scope:

PS C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.20.2201.0_x64__8wekyb3d8bbwe> .\winget.exe list --id 9WZDNCRFJ3PZ --source msstore --accept-source-agreements
No installed package found matching input criteria.

...with explicit user scope:

PS C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.20.2201.0_x64__8wekyb3d8bbwe> .\winget.exe list --id 9WZDNCRFJ3PZ --source msstore --accept-source-agreements --scope user
No installed package found matching input criteria.

...with explicit machine scope:

PS C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.20.2201.0_x64__8wekyb3d8bbwe> .\winget.exe list --id 9WZDNCRFJ3PZ --source msstore --accept-source-agreements --scope machine
Name                    Id           Version
-----------------------------------------------
Microsoft.CompanyPortal 9WZDNCRFJ3PZ 11.2.179.0

My winget version:

.\winget.exe -v
v1.5.2201

It's an easy change to Test-WinGetApp. Just add the machine scope explicitly. Happy to submit a pull request if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions