Windows OS Hub
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server 2025
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
    • Proxmox
  • PowerShell
  • Linux
  • Home
  • About

Windows OS Hub

  • Windows
    • Windows 11
    • Windows 10
    • Windows Server 2025
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
    • Proxmox
  • PowerShell
  • Linux

 Windows OS Hub / Windows 11 / Automate Software and Settings Deployment with WinGet Configure (DSC)

November 13, 2025

Automate Software and Settings Deployment with WinGet Configure (DSC)

In addition to installing app packages from the repository, you can use the WinGet package manager for declarative Windows environment configuration. The idea is that the administrator creates a declarative YAML file describing the desired state of the computer, including Windows settings and required software. Then, WinGet uses PowerShell Desired State Configuration (DSC) to automatically configure Windows to the specified state defined in the YAML file.

WinGet supports managing computer configuration via DSC starting from version 1.6.2631 (released in 2023).

The winget configure command uses PowerShell Desired State Configuration (DSC) 3.0, including the newer Microsoft DSC 3 architecture, to automatically configure Windows to the desired state defined in the configuration file. The YAML configuration file declaratively describes the required system state, including program installations or removals with their versions, Windows features and roles to add or remove, and the necessary Windows and application settings. Applying this YAML file will automate the deployment of the environment on a Windows workstation or server.

Now, let’s take a look at a simple YAML configuration file for Winget. My sample configuration used to install several apps (Firefox, Notepad++, and PowerToys) and remove 7-Zip if it is installed. It also makes changes to the registry (enables Windows registry backup using the EnablePeriodicBackup option).

Microsoft Store apps can be installed/removed by their app IDs. For example, to get the PowerToys app ID, run:

winget show powertoys -s msstore

winget find app id/name

The command to find app package names in Winget:

winget search appname

or among installed apps:

winget list

You can find a sample of such a YAML file in our GitHub repository https://github.com/maxbakhub/winposh/blob/main/DSC/winget_configure_dsc_sample_win11.yaml

Winget Configure DSC sample YAML file

Now, let’s try to apply the configuration from this YAML file via winget configure. First, enable DSC support in WinGet:

winget configure --enable

winget configure enable DSC

Before applying the DSC configuration, it is recommended to validate the syntax of the YAML file.

winget configure validate winget_configure_dsc_sample_win11.yaml

Like Python, YAML files use indentation to define structure. They rely on spaces rather than tabs to represent nested data blocks.

Now, apply the configuration from the YAML file to the computer.

winget configure --file winget_configure_dsc_sample_win11.yaml --accept-configuration-agreements

Winget Configure Desired State Configuration log

WinGet reads the settings from the YAML file, installs/removes the described apps, and applies the specified Windows settings (the ConfigurationRemotingServer.exe process parses the YAML file and applies the settings). Thus, with just one command, you get a fully configured Windows environment. A detailed log of the applied DSC settings will appear on the screen.

Perform a dry run to see how your computer’s current configuration matches the YAML file.

winget configure test -f winget_configure_dsc_sample_win11.yaml --accept-configuration-agreements

For all items that do not match the desired configuration, the command will return:

System is not in the described configuration state.

WinGet: System is not in the described configuration state.

When you reapply the YAML configuration file, Winget Configure will only apply changes that differ from the desired configuration.

The securityContext: elevated directive means that a one-time User Account Control (UAC) elevation prompt is required to apply certain system configuration settings.

With WinGet, you can specify a YAML configuration file located on an external webpage as the source for configuration (this allows the deployment of the desired state configurations to be automated via GitHub/GitLab).

winget configure --accept-configuration-agreements --disable-interactivity -f https://raw.githubusercontent.com/maxbakhub/winposh/refs/heads/main/DSC/winget_configure_dsc_sample_win11.yaml

winget configure with yaml in URL

WinGet allows administrators to configure Windows machines to a specific state using declarative YAML files, ensuring configuration idempotency and supporting the Infrastructure as Code (IaC) approach to Windows environment management. WinGet with DSC lets you implement an Ansible-playbook equivalent for Windows devices, enabling declarative, automated configuration management.

0 comment
1
Facebook Twitter Google + Pinterest
PowerShellQuestions and AnswersWindows 11Windows Server 2025
previous post
Fix: Windows 11 Installation Stuck at Windows Logo

Related Reading

Configuring RemoteApps Hosted on Windows 10/11 (without Windows...

January 25, 2025

Bridging Multiple Network Interfaces on Windows

November 21, 2024

Fix: Windows Update Tab (Button) is Missing from...

December 16, 2024

Change BIOS from Legacy to UEFI without Reinstalling...

April 23, 2025

How to Prefer IPv4 over IPv6 in Windows...

April 15, 2025

How to Detect Which User Installed or Removed...

June 25, 2025

Find a Process Causing High Disk Usage on...

July 16, 2025

Map a Network Drive over SSH (SSHFS) in...

May 13, 2025

Leave a Comment Cancel Reply

join us telegram channel https://t.me/woshub
Join WindowsHub Telegram channel to get the latest updates!

Recent Posts

  • SMB over QUIC: Mount File Share over Internet without VPN on Windows Server 2025

    November 4, 2025
  • How to Find a Previous Computer Name in Windows

    October 28, 2025
  • Stop Windows Server from Auto-Shutdown Every Hour

    October 22, 2025
  • How to Delete a Windows Service via CMD or PowerShell

    October 16, 2025
  • Resource Fair Sharing in Windows Server Remote Desktop Services (RDS)

    October 6, 2025
  • How to Disable (Enable) Credential Guard in Windows 11

    October 6, 2025
  • Wrong Network Profile on Windows Server after Reboot

    September 30, 2025
  • How to Get Windows 10 Extended Security Updates After End-Of-Life

    September 24, 2025
  • Blocking NTLM Connections on Windows 11 and Windows Server 2025

    September 23, 2025
  • Windows Stucks at ‘Getting Windows Ready, Don’t Turn Off Computer’

    September 15, 2025

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • Run PowerShell Scripts on a Schedule with Task Scheduler
  • How to Assign (Passthrough) a Physical GPU to a Hyper-V Virtual Machine
  • Extend an Expired User Password in Active Directory
  • Run Elevated Commands with Sudo on Windows 11
  • Fix: Slow Startup of PowerShell Console and Scripts
  • Check Windows 11 Hardware Readiness with PowerShell Script
  • How to Pause (Delay) Update Installation on Windows 11 and 10
Footer Logo

@2014 - 2024 - Windows OS Hub. All about operating systems for sysadmins


Back To Top