microsoft / winget-cli

WinGet is the Windows Package Manager. This project includes a CLI (Command Line Interface), PowerShell modules, and a COM (Component Object Model) API (Application Programming Interface).
https://learn.microsoft.com/windows/package-manager/
MIT License
22.56k stars 1.4k forks source link

Generate configuration from machine state #3274

Open denelon opened 1 year ago

denelon commented 1 year ago

Description of the new feature / enhancement

I want to be able to generate a configuration based on my current machine.

~Reference work:~ ~https://devblogs.microsoft.com/scripting/reverse-desired-state-configuration-how-it-works/~

~There is likely some needed work to enable reverse DSC.~ ~We would need to "inspect" the current system, pull down associated DSC resources, and generate a configuration.~

Customer verbatim

jouni nieminen

Proposed technical implementation details

winget configure export <path to file> This would iterate over installed packages and generate a WinGet Configuration. If an associated DSC resource is present in the manifest for the package, it would call "export" via DSC v3 and add the configuration as a dependency on install (using Microsoft.WinGet.DSC).

Additionally, the export could include the Windows Settings using Microsoft.Windows.Developer.

Depends on:

LarryOsterman commented 1 year ago

I might suggest improving the title so that a search finds it? "Reverse DSC" doesn't really allow someone who isn't on the team to understand it, and it would probably result in fewer duplicate bugs.

denelon commented 10 months ago

The work over at the PowerShell/DSC GitHub project is tracked via:

denelon commented 10 months ago

This would depend on:

We're thinking something like:

For getting the configuration from a single package (we're also thinking about a set of packages) winget configure export <PackageID> -o *.dsc.yaml

For getting the entire configuration from all installed packages winget configure export -o *.dsc.yaml