You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Windows Package Manager needs work per-installer type to determine if we can dynamically specify scope to the underlying installer. For instance, MSI supports specifying it, as well as embedding the value. And MSIX can be installed for the machine, but requires additional code to convert the user install to a machine install.
So for each type, we need to understand:
Are there command line options that let us choose the scope dynamically?
Is there metadata embedded in the installer that will tell us the scope?
If 2, can it be overridden or would that lead to a dysfunctional package?
With this we could then improve the default behaviors, as currently we don't allow unknown scopes to meet the requirement of a particular given one.
For 2, one way that could be found for exe installers could come from whether or not the installer returns a successful error code if it is ran via a non-admin user account (the environment variable __COMPAT_LAYER=RunAsInvoker tells Windows not to ask for UAC elevation, so if you aren't running as Administrator or SYSTEM, it'd suffice).
Easton Pillay (@jedieaston) I agree. As we move forward, many of these scenarios will need additional automated testing. Our validation processes are fairly long running, so we're looking at how we might be able to run some of these tests in parallel to keep processing time to a reasonable minimum.
Are the NSIS commandline switches /AllUsers vs /CurrentUser supported "out of the box" for this feature, or do they have to be specified somehow in the manifest?
Jaifroid (@Jaifroid) we have more work to do for "User" vs. "Machine". The current list of "InstallerTypes" we commonly allow the client to support without switches doesn't have "NSIS", but some installers have evolved over time.
Jaifroid (@Jaifroid)
Yes, but we haven't performed enough testing across "nullsoft" installers (or any other .exe based installers) to have confidence in consistent behavior with "User" vs. "System".
If I specify scope as machine, and no scope selection is available for a package, what will happen?
As is, there is no way to predetermine whether a package supports selection, so, in a script, would I just add --scope machine to every package regardless?
The default behavior when scope is specified is to go with user unless machine is specified. We may need to add some kind of "supported scopes" or "package default scope" to the schema for this scenario.
The manifest supports specifying scope for a given installer. Sometimes this is managed by passing arguments to the installer.
If both user and machine are specified in the manifest, the client will default to user (unless an argument or settings changes the default behavior).
If the manifest has no information about the scope of the installer, it is just executed as specified in the manifest (or by switches passed by the user).
Different .exe-based installers may behave differently than expected. The scenario you are mentioning would depend on how the manifest is configured, and the installer itself.
If the manifest has no information about the scope of the installer, it is just executed as specified in the manifest (or by switches passed by the user).
[CLI ] Installer [X64,nullsoft,User,] not applicable: Installer scope does not match required scope: User != Machine
[CLI ] Terminating context: 0x8a150010 at D:\a\_work\1\s\external\pkg\src\AppInstallerCLICore\Workflows\InstallFlow.cpp:74
Another scenario in favor of not erroring out if machine is specified but not currently available for a package:
If a package that did not support the machine scope previously, but does eventually, the user will have no way of knowing (unless they manually check all the manifests on a regular basis which practically defeats the purpose of using a package manager).
OTOH they could just specify machine from the get-go, and the package will just be installed in user until machine support is added.
The scope-handling framework this issue called for has been implemented.
Dynamic scope selection
winget install --scope user|machine selects scope at the command line.
Settings provide a persistent preference (installBehavior.preferences.scope) and a hard requirement (installBehavior.requirements.scope); command-line --scope overrides settings.
Scope matching and defaults
A dedicated scope comparator filters and ranks installers: a requirement must be satisfied, a preference is applied best-effort with tie-breaking. This drives the default installer selection.
The original concern - that an unknown installer scope couldn't satisfy a given requirement - is addressed: unknown scope can be explicitly allowed to meet a requirement, and for upgrade unknown scope is treated as a match so existing installs keep working.
Per-installer-type handling
WinGet now distinguishes types whose scope it can control directly (Font, Portable, MSIX, MSStore) from Win32 types that carry scope in the manifest/installer switches:
Win32 - per-user vs. machine-wide via the installer's own mechanism (e.g., MSI ALLUSERS); machine-scope installs are gated on elevation.
MSIX - user scope registers the package per-user; machine scope provisions and registers it for all users.
Out of scope here: the remaining system-context gaps for MSIX are a Windows platform limitation being worked on by the MSIX team - not something WinGet can resolve in this issue.
Closing as completed now that the scope framework and per-type behaviors are in place. If a specific installer type still mis-detects or mis-applies scope, please open a new, targeted issue with the package details.
(Drafted with GitHub Copilot assistance.)
Reacted by Whindmar Saksit, Olav Rønnestad Birkeland and Mr Beedell, Roke Julian Lockhart
Demitrius Nelon (@denelon), I am a lay man, so does that mean that the suggestion, that #issuecomment-1185795000 specifies, has been remediated? Additionally, what MSIX "system context" do you refer to? The immediate context does not appear to explain.
Activity
jedieaston commentedon May 14, 2021
For 2, one way that could be found for exe installers could come from whether or not the installer returns a successful error code if it is ran via a non-admin user account (the environment variable
__COMPAT_LAYER=RunAsInvokertells Windows not to ask for UAC elevation, so if you aren't running as Administrator or SYSTEM, it'd suffice).For MSIs, the ALLUSERS property in the database seems to control it. If it is equal to "" or 2, it will install for a single user, if it is set to 1, the MSI can only be installed for the entire machine. https://docs.microsoft.com/en-us/windows/win32/msi/allusers
I'm beginning to think there's going to be a need for a set of tests for manifests to check all of the different scenarios.
denelon commentedon May 14, 2021
Easton Pillay (@jedieaston) I agree. As we move forward, many of these scenarios will need additional automated testing. Our validation processes are fairly long running, so we're looking at how we might be able to run some of these tests in parallel to keep processing time to a reasonable minimum.
Jaifroid commentedon Jun 5, 2021
Are the NSIS commandline switches
/AllUsersvs/CurrentUsersupported "out of the box" for this feature, or do they have to be specified somehow in the manifest?denelon commentedon Jun 7, 2021
Jaifroid (@Jaifroid) we have more work to do for "User" vs. "Machine". The current list of "InstallerTypes" we commonly allow the client to support without switches doesn't have "NSIS", but some installers have evolved over time.
Jaifroid commentedon Jun 7, 2021
Demitrius Nelon (@denelon) NSIS = Nullsoft Scriptable Install System, so you do in principle support it with the key
nullsoft.denelon commentedon Jun 7, 2021
Jaifroid (@Jaifroid)
Yes, but we haven't performed enough testing across "nullsoft" installers (or any other .exe based installers) to have confidence in consistent behavior with "User" vs. "System".
github-account1111 commentedon Apr 10, 2022
If I specify scope as machine, and no scope selection is available for a package, what will happen?
As is, there is no way to predetermine whether a package supports selection, so, in a script, would I just add
--scope machineto every package regardless?denelon commentedon Apr 11, 2022
github-account1111,
The default behavior when scope is specified is to go with user unless machine is specified. We may need to add some kind of "supported scopes" or "package default scope" to the schema for this scenario.
github-account1111 commentedon Apr 11, 2022
You mean specified by the manifest, not the user, correct?
So if I specify machine but no machine is available it will not error out?
denelon commentedon Apr 11, 2022
The manifest supports specifying scope for a given installer. Sometimes this is managed by passing arguments to the installer.
If both user and machine are specified in the manifest, the client will default to user (unless an argument or settings changes the default behavior).
If the manifest has no information about the scope of the installer, it is just executed as specified in the manifest (or by switches passed by the user).
Different .exe-based installers may behave differently than expected. The scenario you are mentioning would depend on how the manifest is configured, and the installer itself.
github-account1111 commentedon May 2, 2022
I've just tested and that is not the case:
That errors out with:
github-account1111 commentedon Jul 15, 2022
Another scenario in favor of not erroring out if
machineis specified but not currently available for a package:If a package that did not support the
machinescope previously, but does eventually, the user will have no way of knowing (unless they manually check all the manifests on a regular basis which practically defeats the purpose of using a package manager).OTOH they could just specify
machinefrom the get-go, and the package will just be installed inuseruntilmachinesupport is added.denelon commentedon Jul 27, 2026
The scope-handling framework this issue called for has been implemented.
Dynamic scope selection
winget install --scope user|machineselects scope at the command line.installBehavior.preferences.scope) and a hard requirement (installBehavior.requirements.scope); command-line--scopeoverrides settings.Scope matching and defaults
Per-installer-type handling
WinGet now distinguishes types whose scope it can control directly (Font, Portable, MSIX, MSStore) from Win32 types that carry scope in the manifest/installer switches:
ALLUSERS); machine-scope installs are gated on elevation.Out of scope here: the remaining system-context gaps for MSIX are a Windows platform limitation being worked on by the MSIX team - not something WinGet can resolve in this issue.
Closing as completed now that the scope framework and per-type behaviors are in place. If a specific installer type still mis-detects or mis-applies scope, please open a new, targeted issue with the package details.
(Drafted with GitHub Copilot assistance.)
beedell-roke commentedon Jul 27, 2026
Demitrius Nelon (@denelon), I am a lay man, so does that mean that the suggestion, that
#issuecomment-1185795000specifies, has been remediated? Additionally, what MSIX "system context" do you refer to? The immediate context does not appear to explain.