How to Use WinGet Configuration in Windows 11 to Automate Machine Setup with DSC

Setting up a newly formatted PC or configuring standard developer workstations manually can consume hours of installing software, cloning repositories, and adjusting system preferences. Windows 11 introduces WinGet Configuration, a built-in mechanism powered by PowerShell Desired State Configuration (DSC) and YAML manifests. It allows administrators and power users to declare software packages, Windows settings, and dependencies in a single file and apply them reliably with a single command.

Understanding WinGet Configuration Files

A WinGet configuration file uses a structured YAML format (often named configuration.dsc.yaml) that defines the exact state a Windows 11 environment should achieve. The manifest is divided into modular resource blocks:

  • WinGet Package Manager: Declares applications, dev tools, and utilities to download and install silently via the Windows Package Manager repository.
  • PowerShell Modules & DSC Resources: Invokes declarative configuration modules to toggle Windows Optional Features (such as WSL or Hyper-V) and adjust system parameters.
  • Security Assertions: Validates OS version prerequisites, administrator privileges, and hardware requirements before executing package installations.

Creating a Basic WinGet Configuration Manifest

To automate software deployment, create a file named setup.dsc.yaml using any text editor, such as Visual Studio Code or Notepad:

# yaml-language-server: $schema=https://aka.ms/configuration-dsc-schema/0.2
properties:
  resources:
    - resource: Microsoft.WinGet.DSC/WinGetPackage
      id: vscode
      directives:
        description: Install Visual Studio Code
        allowPrerelease: false
      settings:
        id: Microsoft.VisualStudioCode
        source: winget

    - resource: Microsoft.WinGet.DSC/WinGetPackage
      id: git
      directives:
        description: Install Git Version Control
      settings:
        id: Git.Git
        source: winget

    - resource: Microsoft.WinGet.DSC/WinGetPackage
      id: powertoys
      directives:
        description: Install Microsoft PowerToys
      settings:
        id: Microsoft.PowerToys
        source: winget
  configurationVersion: 0.2.0

Testing and Applying the Configuration in Windows 11

Before modifying your system, Windows Package Manager lets you validate and test the manifest syntax safely:

Step 1: Test Manifest Integrity

Open an elevated Windows Terminal (PowerShell as Administrator) and navigate to the directory containing your configuration file. Run the test command to verify whether items are already installed or require changes:

winget configure test .\setup.dsc.yaml

WinGet will inspect your local system against the desired state and report which resources are absent or non-compliant without executing installations.

Step 2: Apply the Configuration

When you are ready to provision the computer, run the configuration engine:

winget configure .\setup.dsc.yaml

Windows Terminal will present a security prompt detailing the modules and packages about to be modified. Press Y and press Enter to confirm. WinGet will pull the required resources, download packages silently, and apply all declared configurations in sequence.

Automating Post-Installation Workflows and Developer Drives

WinGet Configuration natively integrates with modern Windows 11 developer features, including Dev Drive (ReFS storage for accelerated build performance) and Windows Subsystem for Linux (WSL):

  • Enable Optional Features: You can embed DSC modules like Microsoft.Windows.Developer/DevDrive to format and mount virtual developer storage automatically.
  • Version Control Tracking: Store your .dsc.yaml manifests inside a private GitHub or GitLab repository. When onboarding a new team member or setting up a replacement laptop, cloning the repository and executing winget configure restores an identical work environment in minutes.
  • Unattended Provisioning: Use the --accept-configuration-agreements flag when integrating WinGet Configuration into automated provisioning scripts or Microsoft Intune deployment pipelines.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.