Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Winget --scope machine not working for appx applications #3553

Open
Vicent8899 opened this issue Aug 25, 2023 · 5 comments
Open

Winget --scope machine not working for appx applications #3553

Vicent8899 opened this issue Aug 25, 2023 · 5 comments
Labels
Command-Install Issue related to WinGet Install Issue-Bug It either shouldn't be doing this or needs an investigation. msstore Issue related to "msstore" REST source

Comments

@Vicent8899
Copy link

Brief description of your issue

Installing Appx applications with Winget in a machine --scope machine context does not work. We want to install it for all users of a machine Windows 10 22H2.

For instance when trying to install the appx smapone app

Winget install smapone --scope machine

We enabled debug logging and we got this result:

023-08-24 14:49:39.371 [CLI ] Device wide install for msstore type is not supported under admin context.
2023-08-24 14:49:39.371 [CLI ] Terminating context: 0x8a150113 at D:\a_work\1\s\external\pkg\src\AppInstallerCLICore\Workflows\MSStoreInstallerHandler.cpp:b7

Despite the error in the logs the scope machine for Winget required admin rights.

At the moment we are installing it like this, but it does not install for all users.
winget install $app --verbose --accept-source-agreements --accept-package-agreements --silent

Your help is appreciated.

Steps to reproduce

For instance when trying to install the appx smapone app
Winget install smapone --scope machine
results in error
023-08-24 14:49:39.371 [CLI ] Device wide install for msstore type is not supported under admin context.
2023-08-24 14:49:39.371 [CLI ] Terminating context: 0x8a150113 at D:\a_work\1\s\external\pkg\src\AppInstallerCLICore\Workflows\MSStoreInstallerHandler.cpp:b7

Expected behavior

The expected behavior is that the appx application should install for all users under the machine scope.

Actual behavior

We are failing to install the appx package under the machine scope.

Environment

WinGet, version [1.5.1881]
OS: Windows.Desktop v10.0.19045.3324
Package: Microsoft.DesktopAppInstaller v1.20.1881.0
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Triage Issue need to be triaged label Aug 25, 2023
@Trenly
Copy link
Contributor

Trenly commented Aug 25, 2023

Looking at the code, I see this comment:

// TODO: There was a bug in InstallService where admin user is incorrectly identified as not admin,
// causing false access denied on many OS versions.
// Remove this check when the OS bug is fixed and back ported.

Tracing back, it was initially added by @yao-msft in this PR -

In this case, based on the code, the expected behavior is that the appx application should be blocked from install under the machine scope until the OS bugs have been fixed.

@bthorpkt
Copy link

This should provision AppX Packages system wide so all users get them w/ registrations so they appear in the users space and for uninstall 'unprovision the appx package'

@gabrielgbs97
Copy link

You can install machine wide apps with current OS APIs. See Add-AppxProvisionedPackage, it installs an Appx as part of windows image, at next login or new user login, they will register it. If there is an update, the app may update an re-registered by store/PMAPI in user context.

Winget should perform equivalent functionality to add-appxprovisionedpackage when performing machine install of modern apps.

@bthorpkt
Copy link

Here is what we expect winget to do, but it falls completely short of being able to do:

  1. Run as system to install MSSTORE Appx and MSIX files system wide as-is with the --scope machine flag [and do the below]
  2. when running as system, download the source files, if it needs to some temp location (this also fails when you do a download in winget because.... for some odd reason needs to auth to Entra ID WITH some sketchy rights (https://www.deploymentresearch.com/using-winget-to-download-microsoft-store-applications/) so you have to hop into userspace with a user on your tenant to pull the files if you're trying to script this all out which I am
  3. As @gabrielgbs97 notes, provision the appx or msix as a system level app, which will register with each user on the system thus being "system installed"

The core reasons for this are the Store for Business being pulled and support for WSFB being pulled from SCCM. We manage machines that are multi-user and don't want 50 or 100 copies of the apps installed on machines for each user and prefer the app be system provisioned and registered for each user instead.

We also want to ensure apps on machines are up to date from the store by forcing a winget update on all of them, even the Out Of Box apps such as Notepad or MSPaint.

There are a ton of people apparently trying to do this or similar via PowerShell per https://techcommunity.microsoft.com/t5/windows-it-pro-blog/use-winget-1-8-to-download-microsoft-store-apps/ba-p/4204522

@github-account1111
Copy link

Maybe Microsoft should make Store apps installable system-wide instead of duplicating a copy of the same app for every user. That was a weird decision to begin with and is wasteful at best. No other OS does this, mobile or desktop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Command-Install Issue related to WinGet Install Issue-Bug It either shouldn't be doing this or needs an investigation. msstore Issue related to "msstore" REST source
Projects
None yet
Development

No branches or pull requests

6 participants