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

[Spec] WinGet configure export and import settings #3694

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
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
97 changes: 97 additions & 0 deletions doc/specs/#x - WinGet Settings export and import.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
---
author: Roy MacLachlan rdmaclachlan/[email protected]

Check failure on line 2 in doc/specs/#x - WinGet Settings export and import.md

View workflow job for this annotation

GitHub Actions / Check Spelling

`rdmaclachlan` is not a recognized word. (unrecognized-spelling)
created on: 2023-09-26
last updated: 2023-09-26
issue id: 3693
---

# Export and Import WinGet Settings

Link to issue: "For [#3693](https://github.com/microsoft/winget-cli/issues/3693)"

## Abstract

The Windows Package Manager client does not have an automatable approach for the application of user settings. Each time I setup a Windows Sandbox, or new Virtual Machine I need to add my unique sources (`winget source add -t "Microsoft.REST" -a "https://winget.com/api" -n "REST"`), then to enable the desired user experiences I must run `winget settings` select a text editor, then either manually type in my configuration settings or copy them from another device.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an interesting statement, since sources aren't part of the winget settings file.

I read this more as "There should be a way for me to export my current winget configuration - including all user settings, sources, pins, etc. . .", is that accurate? In which case, I would imagine the preferred path would be to export as a configuration file that winget can use with winget configure to apply the appropriate settings?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The scenario that I am looking to resolve is: I can automate the configuration of all Winget configurable settings.

WinGet Source can be Winget source add, after this change, a user could run WinGet Settings import to apply settings. Pinning was not taken into account....



## Inspiration

I frequently use WinGet to setup and configure my Windows Sandbox environments. However each time I connect to my Windows Sandbox I need to manually re-apply my user settings.

## Solution Design

The new user experience will expand on the existing WinGet Settings / WinGet Settings Export commands. No changes will be made to the existing user experience.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The winget settings export command already exists, but only prints the admin settings and the path to the user settings file. Based on the description below, would this behavior need to change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The approach I was thinking about with this was that if the user runs winget settings export then the existing experience would be maintained. If they provide --Path as a parameter, then we would create a file with the settings in it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, makes sense

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather focus on the DSC v3 "export" verb for this scenario. The Microsoft.WinGet.DSC resource already allows setting both user and administrative settings.


The new sub-commands will provide the ability to export the current WinGet CLI user settings, or Import a preconfigured set of settings stored in a file on the local machine.

## UI/UX Design

The new sub-commands will have a parameter input that supports providing a path to a local JSON file that will or does contain the Winget user settings.

```
WinGet Settings Export
-p, --Path The path to the Winget user settings JSON file to be created.
```

```
WinGet Settings Import
-p, --Path The path to the existing Winget user settings JSON file.
```

### WinGet Settings Export CLI

The following command provides the ability to export the current user settings to a JSON file on the local machine. `--Path` represents the path to a file where the settings will be exported to.

`WinGet Settings Export --Path C:\WinGet\Settings.json`

The file generated will contain the settings that can be used on another device to import the settings.

### WinGet Settings Import CLI

The following command provides the ability to import the user settings from a JSON file to the current user's WinGet CLI settings. `--path` is representative of the source file that contains the WinGet CLI user settings.

`WinGet Settings Import --Path C:\WinGet\Settings.json`

### WinGet Settings Import GPO

The following Group Policy object will enable enterprise customers with the ability to apply their desired winGet user settings to devices within their environment.

**Title:** Apply WinGet User Settings

**Description:** This policy will allow you the ability to apply a pre-configured set of user settings to the installed WinGet CLI.

If you enable this policy, you can provide the UNC path to a configuration JSON file that will be applied to the WinGet CLI user settings.

If you disable, or do not configure this policy, The WinGet user settings will not be enforced on the client device.

## Capabilities

### Accessibility

Users can use a pre-loaded configuration file, preventing the need to copy and paste, or manually type in the desired user experience.

### Security

Improve security as it will ensure a consistent experience can be applied.

### Reliability

Consistent user experience.

### Compatibility

N/A

### Performance, Power, and Efficiency

## Potential Issues

None.

## Future considerations

None.

## Resources

[comment]: # Be sure to add links to references, resources, footnotes, etc.
Loading