Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
f8dced0
initial spec
JohnMcPMS Oct 29, 2026
1e1848d
spec update
JohnMcPMS Oct 29, 2026
383d1cb
schema descriptions for restricted properties
JohnMcPMS Oct 29, 2026
7458119
AdminFile setting streams
JohnMcPMS Oct 29, 2026
f75226b
initial settings changes
JohnMcPMS Oct 29, 2026
96e05b0
cp
JohnMcPMS Oct 29, 2026
db89a85
Handle parsing uniformly
JohnMcPMS Oct 29, 2026
5647ea2
custom resolve
JohnMcPMS Oct 29, 2026
9859ea7
tests
JohnMcPMS Oct 29, 2026
c1c1dbd
test fixes
JohnMcPMS Oct 30, 2026
07aec0b
admin settings ux
JohnMcPMS Nov 2, 2026
8de5fb3
PS admin settings changes
JohnMcPMS Nov 2, 2026
3e4bd02
settings update and tests
JohnMcPMS Nov 2, 2026
e087b1c
dscv3 resource
JohnMcPMS Nov 2, 2026
ca55dc7
spelling and test fixes
JohnMcPMS Nov 3, 2026
025d04c
Module path defaults to secure location
JohnMcPMS Nov 3, 2026
8c7efc4
update docs
JohnMcPMS Nov 3, 2026
ad8daac
release note
JohnMcPMS Nov 3, 2026
35763e3
settings doc
JohnMcPMS Nov 3, 2026
6cec6cd
self-review fixes
JohnMcPMS Nov 3, 2026
51fd2a8
spelling
JohnMcPMS Nov 3, 2026
d011b9f
blank line
JohnMcPMS Nov 4, 2026
c142534
test update
JohnMcPMS Nov 5, 2026
81161ad
unsigned
JohnMcPMS Nov 9, 2026
16eb8b4
test fixes
JohnMcPMS Nov 11, 2026
d78cb1c
allow GP fallback when admin file fails
JohnMcPMS Nov 11, 2026
9604567
tests need modules
JohnMcPMS Nov 12, 2026
0215314
Merge from master
JohnMcPMS Nov 12, 2026
f392863
Remove using settings from PS module, switch to PS default locations
JohnMcPMS Nov 19, 2026
d202f85
test
JohnMcPMS Nov 19, 2026
ef7f9b2
Move from Admin:bool to Context:enum and make it a key
JohnMcPMS Nov 19, 2026
ac6c358
line
JohnMcPMS Nov 23, 2026
16ae641
Merge from master
JohnMcPMS Dec 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/actions/spelling/allow.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ addportablefile
addstore
admins
AFX
anonymization
appinstaller
appmodel
appxbundle
Expand Down Expand Up @@ -274,6 +275,7 @@ prioritization
processthreadsapi
PRODUCTNAME
PRODUCTVERSION
PROGRAMDATA
PROGRESSONLY
promptrestart
PROPERTYDUMP
Expand Down
110 changes: 109 additions & 1 deletion doc/Settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,92 @@ If you are using the non-packaged WinGet version by building it from source code

If you are creating a settings file from scratch, make sure that the line `"$schema": "https://aka.ms/winget-settings.schema.json",` is in it.

## Administrator Settings

WinGet supports an administrator-managed `admin-settings.json` file for each
user. Values in this file take precedence over regular user settings, including
when WinGet runs without administrator privileges. Default install and module
folders are the exception: you can configure separate folders for normal and
administrator use.

You can add any supported setting to this file. Your organization's Group Policy
settings still take precedence over both settings files.

To create or edit administrator settings, open a terminal using **Run as
administrator**, then run:

```powershell
winget settings --admin
```

This opens `admin-settings.json`, creating it if needed. It uses the same setting
names and JSON format as `settings.json`, but only an administrator can save
changes. Each user has their own administrator settings file. You can open an
existing file without administrator privileges to read it.

Run `winget settings export` to find both file locations, listed as
`userSettingsFile` and `adminSettingsFile`. The new file is separate from the
features enabled or disabled with `winget settings --enable` and `--disable`.

### Settings that require administrator configuration

When running as administrator, WinGet ignores the following settings in your
regular `settings.json`. To keep your custom values for administrator use, add
them to `admin-settings.json`; otherwise, WinGet uses their defaults. A warning
identifies settings that need to be moved.

| Setting | When the value in `admin-settings.json` is used |
|---|---|
| `installBehavior.portablePackageUserRoot` | With or without administrator privileges. |
| `installBehavior.portablePackageMachineRoot` | With or without administrator privileges. Installing or changing machine-wide portable packages still requires administrator privileges. |
| `downloadBehavior.defaultDownloadDirectory` | With or without administrator privileges. |
| `uninstallBehavior.purgePortablePackage` | With or without administrator privileges. |
| `installBehavior.defaultInstallRoot` | Only when running as administrator. Otherwise, your regular settings apply. |
| `configureBehavior.defaultModuleRoot` | Only when running as administrator. Otherwise, your regular settings apply. |

If an administrator setting has an invalid value, WinGet warns and uses its
default rather than the value from your regular settings. If the administrator
file cannot be read and its backup cannot be used, WinGet warns and uses defaults
instead of either settings file. You can still open the file to repair it.

### Keeping a default value

Set a value to `null` in `admin-settings.json` to keep WinGet's default, even if
your regular settings specify something else. This does not produce a warning.
The two settings marked "Only when running as administrator" above still apply
only in that case, and Group Policy continues to take precedence.

For example, this keeps the default download folder whether or not you run
WinGet as administrator:

```json
{
"$schema": "https://aka.ms/winget-settings.schema.json",
"downloadBehavior": {
"defaultDownloadDirectory": null
}
}
```

### PowerShell and configuration files

PowerShell supports `-Admin` on `Get-WinGetUserSetting`,
`Test-WinGetUserSetting`, and `Set-WinGetUserSetting` to select the administrator
file. Only Set requires administrator privileges. These commands read or change
the selected file, rather than combining the two files.

`Set-WinGetUserSetting -Merge` skips values set to `$null`. To save a null, omit
`-Merge` and include all settings you want to keep, since this replaces the file.

For DSC, use `Context = 'Administrator'` with `WinGetUserSettings`, or `"context": "Administrator"` with
the DSCv3 `UserSettingsFile` resource. Saving administrator settings requires
administrator privileges. With PowerShell DSC, use `Action = 'Full'` to save a null.

> [!IMPORTANT]
> For administrator module folders, choose a location that requires
> administrator privileges to change. Adding a folder to administrator settings
> does not change its permissions or protect files already in it.

## Source

The `source` settings involve configuration to the WinGet source.
Expand Down Expand Up @@ -92,6 +178,8 @@ The `disableInstallNotes` behavior affects whether installation notes are shown

The `portablePackageUserRoot` setting affects the default root directory where packages are installed to under `User` scope. This setting only applies to packages with the `portable` installer type. Defaults to `%LOCALAPPDATA%/Microsoft/WinGet/Packages/` if value is not set or is invalid.

To use this setting when running as administrator, configure it in [administrator settings](#administrator-settings). That value also applies when running normally.

> Note: This setting value must be an absolute path.

```json
Expand All @@ -104,6 +192,8 @@ The `portablePackageUserRoot` setting affects the default root directory where p

The `portablePackageMachineRoot` setting affects the default root directory where packages are installed to under `Machine` scope. This setting only applies to packages with the `portable` installer type. Defaults to `%PROGRAMFILES%/WinGet/Packages/` if value is not set or is invalid.

To use this setting when running as administrator, configure it in [administrator settings](#administrator-settings). That value also applies when running normally. Changing machine-wide portable packages requires administrator privileges.

> Note: This setting value must be an absolute path.

```json
Expand Down Expand Up @@ -205,6 +295,8 @@ By default, when no user preference or requirement is configured, WinGet selects

The `defaultInstallRoot` affects the install location when a package requires one. This can be overridden by the `--location` parameter. This setting is only used when a package manifest includes `InstallLocationRequired`, and the actual location is obtained by appending the package ID to the root.

Use [administrator settings](#administrator-settings) to choose the root for commands run as administrator. Your regular settings continue to apply when running normally.

```json
"installBehavior": {
"defaultInstallRoot": "C:/installRoot"
Expand All @@ -231,6 +323,8 @@ The `uninstallBehavior` settings affect the default behavior of uninstalling (wh

The `purgePortablePackage` behavior affects the default behavior for uninstalling a portable package. If set to `true`, uninstall will remove all files and directories relevant to the `portable` package. This setting only applies to packages with the `portable` installer type. Defaults to `false` if value is not set or is invalid.

To use this setting when running as administrator, configure it in [administrator settings](#administrator-settings). That value also applies when running normally.

```json
"uninstallBehavior": {
"purgePortablePackage": true
Expand All @@ -243,7 +337,19 @@ The `configureBehavior` settings affect the default behavior of applying a confi

### Default Module Root

The `defaultModuleRoot` behavior affects the default root directory where modules are installed to. Defaults to `%LOCALAPPDATA%/Microsoft/WinGet/Configuration/Modules` if value is not set or is invalid.
The `defaultModuleRoot` behavior affects the default root directory where modules are installed to. Normally, the default is `%LOCALAPPDATA%\Microsoft\WinGet\Configuration\Modules`. When running as administrator, WinGet uses a separate protected folder instead.

Use [administrator settings](#administrator-settings) to choose the module folder for configurations run as administrator. Your regular settings continue to apply when running normally.

Configurations that require administrator privileges use the administrator module folder, even when started from a regular terminal. Modules from your regular WinGet module folder are not automatically reused, so WinGet may need to download them again.

You can still choose a folder with `--module-path` (or PowerShell `-ModulePath`). Specifying `default` uses WinGet's default folder rather than this setting.

PowerShell configuration commands do not use this setting from either settings
file. They use PowerShell's `AllUsers` module folder when running as
administrator and `CurrentUser` otherwise, unless you choose a folder with
`-ModulePath`. For these commands, `-ModulePath default` selects that same
PowerShell default.

> Note: This setting value must be an absolute path.

Expand All @@ -261,6 +367,8 @@ The `downloadBehavior` settings affect the default behavior of downloading packa

The `defaultDownloadDirectory` setting affects the default directory where installers are downloaded to. Defaults to `%USERPROFILE%/Downloads/` if value is not set or is invalid.

To use this setting when running as administrator, configure it in [administrator settings](#administrator-settings). That value also applies when running normally.

> Note: This setting value must be an absolute path.

```json
Expand Down
25 changes: 25 additions & 0 deletions doc/release-notes/1.31/protected-settings-overlay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## New Features

### Protected administrator settings

WinGet now supports an administrator-managed settings file for each user.
Settings in this file take precedence over regular user settings, including
when WinGet runs without administrator privileges. Install and module folders
are the exception: you can configure separate folders for normal and
administrator use.

To edit the new `admin-settings.json` file, open a terminal using
**Run as administrator**, then run
`winget settings --admin`.
PowerShell user-setting cmdlets also support `-Admin`.

When running as administrator, WinGet now uses this file instead of your regular
settings for portable package folders, the default install folder, the
configuration module folder, the download folder, and portable-package cleanup.
If you previously customized these settings, WinGet displays a warning directing
you to configure their administrator values.

Configurations run as administrator now use a separate default module folder, so
WinGet may need to download modules again.

See [Administrator Settings](https://github.com/microsoft/winget-cli/blob/master/doc/Settings.md#administrator-settings) for details.
Loading
Loading