Skip to main content
Complete reference documentation for all WinGet DSC resources.

WinGetPackage

Manages the installation state of packages.

Properties

Id
string
required
The package identifier. This is a key property.Example: Microsoft.PowerToys
Source
string
The source name. This is a key property that helps uniquely identify the package.Example: winget
Version
string
The specific version to install. If not specified, installs the latest version.Example: 0.70.0
Ensure
enum
default:"Present"
Whether the package should be installed or removed. Valid values:
  • Present - Package should be installed
  • Absent - Package should be removed
MatchOption
enum
default:"EqualsCaseInsensitive"
How to match the package ID. Valid values:
  • Equals - Exact match (case sensitive)
  • EqualsCaseInsensitive - Exact match (case insensitive)
  • StartsWithCaseInsensitive - ID starts with the specified value
  • ContainsCaseInsensitive - ID contains the specified value
UseLatest
bool
default:"false"
Whether to always keep the package updated to the latest version. When true, the resource will ensure updates are installed.
InstallMode
enum
default:"Silent"
The installation mode. Valid values:
  • Default - Use package’s default install mode
  • Silent - Silent installation
  • Interactive - Interactive installation

Methods

  • Get() - Returns the current state of the package
  • Test() - Tests if the package is in the desired state
  • Set() - Ensures the package is in the desired state

Examples

Install Package

- resource: Microsoft.WinGet.DSC/WinGetPackage
  directives:
    description: Install PowerToys
  settings:
    id: Microsoft.PowerToys
    source: winget
    ensure: Present

Install Specific Version

- resource: Microsoft.WinGet.DSC/WinGetPackage
  settings:
    id: Microsoft.VisualStudioCode
    source: winget
    version: 1.85.0
    ensure: Present

Keep Package Updated

- resource: Microsoft.WinGet.DSC/WinGetPackage
  settings:
    id: Git.Git
    source: winget
    useLatest: true
    ensure: Present

Remove Package

- resource: Microsoft.WinGet.DSC/WinGetPackage
  settings:
    id: UnwantedApp
    ensure: Absent

WinGetSource

Manages package sources.

Properties

Name
string
required
The source name. This is a key property.Example: company-repo
Argument
string
required
The source URL or argument.Example: https://packages.company.com
Type
string
The source type.Example: Microsoft.PreIndexed.Package
TrustLevel
enum
default:"Undefined"
The trust level for the source. Valid values:
  • Undefined - No trust level specified
  • None - Untrusted source
  • Trusted - Trusted source
Explicit
bool
Whether the source requires explicit selection. When true, the source must be explicitly specified in commands.
Priority
int
The source priority. Lower numbers have higher priority.Example: 1
Ensure
enum
default:"Present"
Whether the source should exist or be removed. Valid values:
  • Present - Source should be configured
  • Absent - Source should be removed

Methods

  • Get() - Returns the current state of the source
  • Test() - Tests if the source is in the desired state
  • Set() - Ensures the source is in the desired state

Examples

Add Source

- resource: Microsoft.WinGet.DSC/WinGetSource
  directives:
    description: Add company package repository
  settings:
    name: company-repo
    argument: https://packages.company.com
    type: Microsoft.PreIndexed.Package
    trustLevel: Trusted
    ensure: Present

Add Source with Priority

- resource: Microsoft.WinGet.DSC/WinGetSource
  settings:
    name: internal-repo
    argument: https://internal.company.com/packages
    priority: 1
    ensure: Present

Remove Source

- resource: Microsoft.WinGet.DSC/WinGetSource
  settings:
    name: old-repo
    argument: https://old.example.com
    ensure: Absent

WinGetUserSettings

Manages WinGet user settings in settings.json.

Properties

SID
string
required
System identifier. This is a key property. Leave empty - do not set manually.Example: ""
Settings
hashtable
required
A hashtable containing the desired settings. Settings follow the WinGet settings.json schema.
Action
enum
default:"Full"
How to apply settings. Valid values:
  • Full - Replace all settings with the specified values
  • Partial - Merge specified settings with existing settings

Methods

  • Get() - Returns the current user settings
  • Test() - Tests if settings match the desired state
  • Set() - Applies the desired settings

Examples

Configure Visual Settings

- resource: Microsoft.WinGet.DSC/WinGetUserSettings
  directives:
    description: Configure WinGet visual settings
  settings:
    sid: ""
    settings:
      visual:
        progressBar: rainbow
      experimental:
        experimentalCmd: true
    action: Partial

Disable Telemetry

- resource: Microsoft.WinGet.DSC/WinGetUserSettings
  settings:
    sid: ""
    settings:
      telemetry:
        disable: true
    action: Partial

Full Settings Configuration

- resource: Microsoft.WinGet.DSC/WinGetUserSettings
  settings:
    sid: ""
    settings:
      visual:
        progressBar: rainbow
      telemetry:
        disable: false
      experimentalFeatures:
        experimentalCmd: true
        experimentalArg: true
      installBehavior:
        preferences:
          scope: user
    action: Full

WinGetAdminSettings

Manages WinGet administrator settings. Requires administrator privileges.

Properties

SID
string
required
System identifier. This is a key property. Leave empty - do not set manually.Example: ""
Settings
hashtable
required
A hashtable containing the desired admin settings. Keys are admin setting names, values are boolean.

Methods

  • Get() - Returns the current admin settings
  • Test() - Tests if admin settings match the desired state
  • Set() - Applies the desired admin settings

Examples

Enable Local Manifests

- resource: Microsoft.WinGet.DSC/WinGetAdminSettings
  directives:
    description: Enable local manifest files
  settings:
    sid: ""
    settings:
      LocalManifestFiles: true

Configure Multiple Admin Settings

- resource: Microsoft.WinGet.DSC/WinGetAdminSettings
  settings:
    sid: ""
    settings:
      LocalManifestFiles: true
      BypassCertificatePinningForMicrosoftStore: false
      InstallerHashOverride: false
      LocalArchiveMalwareScanOverride: false

WinGetPackageManager

Ensures WinGet is installed and optionally at a specific version.

Properties

SID
string
required
System identifier. This is a key property. Leave empty - do not set manually.Example: ""
Version
string
Specific version of WinGet to install.Example: 1.6.3133
UseLatest
bool
default:"false"
Install the latest stable version of WinGet.
UseLatestPreRelease
bool
default:"false"
Install the latest pre-release version of WinGet. Takes precedence over UseLatest.

Methods

  • Get() - Returns the installed WinGet version
  • Test() - Tests if WinGet is installed at the desired version
  • Set() - Installs or updates WinGet to the desired version

Examples

Ensure WinGet is Installed (Latest)

- resource: Microsoft.WinGet.DSC/WinGetPackageManager
  directives:
    description: Ensure latest WinGet is installed
  settings:
    sid: ""
    useLatest: true

Install Specific Version

- resource: Microsoft.WinGet.DSC/WinGetPackageManager
  settings:
    sid: ""
    version: 1.6.3133

Install Latest Pre-release

- resource: Microsoft.WinGet.DSC/WinGetPackageManager
  settings:
    sid: ""
    useLatestPreRelease: true

Complete Example Configuration

Here’s a complete example using all DSC resources:
properties:
  configurationVersion: 0.2.0
  resources:
    # Ensure WinGet is installed
    - resource: Microsoft.WinGet.DSC/WinGetPackageManager
      directives:
        description: Ensure WinGet is at latest version
      settings:
        sid: ""
        useLatest: true
    
    # Configure admin settings
    - resource: Microsoft.WinGet.DSC/WinGetAdminSettings
      directives:
        description: Configure admin policies
      settings:
        sid: ""
        settings:
          LocalManifestFiles: true
    
    # Configure user settings
    - resource: Microsoft.WinGet.DSC/WinGetUserSettings
      directives:
        description: Configure WinGet preferences
      settings:
        sid: ""
        settings:
          visual:
            progressBar: rainbow
          telemetry:
            disable: false
        action: Partial
    
    # Add custom source
    - resource: Microsoft.WinGet.DSC/WinGetSource
      directives:
        description: Add company package repository
      settings:
        name: company-repo
        argument: https://packages.company.com
        type: Microsoft.PreIndexed.Package
        trustLevel: Trusted
        ensure: Present
    
    # Install development tools
    - resource: Microsoft.WinGet.DSC/WinGetPackage
      directives:
        description: Install Git
      settings:
        id: Git.Git
        source: winget
        useLatest: true
    
    - resource: Microsoft.WinGet.DSC/WinGetPackage
      directives:
        description: Install Visual Studio Code
      settings:
        id: Microsoft.VisualStudioCode
        source: winget
        useLatest: true
    
    - resource: Microsoft.WinGet.DSC/WinGetPackage
      directives:
        description: Install PowerToys
      settings:
        id: Microsoft.PowerToys
        source: winget
        version: 0.70.0

Notes

  • All DSC resources are idempotent - safe to run multiple times
  • Admin resources (WinGetAdminSettings, WinGetSource) require administrator privileges
  • The SID property should be left as an empty string ""
  • Resources can be used in YAML configuration files or PowerShell DSC configurations
  • Use action: Partial for WinGetUserSettings to merge with existing settings

Build docs developers (and LLMs) love