Utilizing Desired State Configuration (DSC) v3 on Home windows Server 2025


Microsoft Desired State Configuration v3 has some substantive modifications in comparison with earlier variations of the know-how. In contrast to PowerShell Desired State Configuration (PSDSC) v1.1 and v2, DSC v3 operates as a standalone command fairly than a service, eliminating the necessity for a neighborhood configuration supervisor. This architectural change makes DSC v3 simpler to make use of and scale, permitting any device that may execute instructions on Home windows Server, similar to Scheduled Duties, to use DSC configurations.

You may set up DSC utilizing WinGet. Home windows Server 2025 consists of built-in assist for WinGet, making the set up course of extra easy than on earlier server variations. Nevertheless, it is essential to notice that winget is barely accessible for Home windows Server 2025 with Desktop Expertise and may’t be used with Server Core deployments.

 

DSC v3 requires PowerShell 7.2 or later. As Home windows Server 2025 comes with Home windows PowerShell 5.1, you may want to put in PowerShell 7.x individually, which you are able to do manually or utilizing WinGet from an elevated PowerShell session.

winget set up microsoft.powershell

The PSDesiredStateConfiguration module specifies a minimal PowerShell model of seven.2 in its module manifest.

WinGet offers probably the most easy set up expertise with automated updates:

  1. Open PowerShell with administrative privileges
  2. Set up the secure model utilizing:
winget set up Microsoft.DSC 

Alternatively, obtain the most recent launch from the PowerShell/DSC repository and add the folder containing the expanded archive contents to your PATH setting variable.

Fundamental DSC v3 Instructions

To view all accessible instructions in DSC v3, use:

dsc --help

The output will show accessible instructions together with:

  • completer – Generate a shell completion script
  • config – Apply a configuration doc
  • useful resource – Invoke a particular DSC useful resource
  • schema – Get the JSON schema for a DSC kind
  • assist – Show assist data for instructions

To see the assets accessible to be used in configurations:

dsc useful resource listing

This command shows all DSC assets put in in your system that can be utilized in configuration paperwork.

Creating DSC v3 Configurations

DSC v3 configurations could be written in YAML format, which is extra concise and readable than the MOF format utilized in earlier variations.

A DSC v3 configuration doc should embrace:

  1. A reference to the DSC useful resource schema
  2. At the least one useful resource definition with properties

Making a Fundamental Configuration

Here is an instance of a primary configuration in YAML format:

$schema: https://uncooked.githubusercontent.com/PowerShell/DSC/fundamental/schemas/2023/08/config/doc.json
assets:
  - identify: Power icon view in Management Panel
    kind: Microsoft.Home windows/Registry
    properties:
      keyPath: HKCUSOFTWAREMicrosoftWindowsCurrentVersionPoliciesExplorer
      valueName: ForceClassicControlPanel
      valueData:
        DWord: 1

This configuration units a registry worth to power the Management Panel to show utilizing the basic icon view.

For compatibility with basic PowerShell assets, you should utilize the WindowsPowerShell useful resource kind:

$schema: https://uncooked.githubusercontent.com/PowerShell/DSC/fundamental/schemas/2024/04/config/doc.json
metadata:
  identify: IIS-Configuration
assets:
  - identify: Use Home windows PowerShell assets
    kind: Microsoft.Home windows/WindowsPowerShell
    properties:
      assets:
        - identify: Net server set up
          kind: PSDesiredStateConfiguration/WindowsFeature
          properties:
            Title: Net-Server
            Guarantee: Current

This configuration makes use of the basic WindowsFeature useful resource from the PSDesiredStateConfiguration module to put in IIS.

As soon as you’ve got created a configuration doc, you possibly can check and apply it utilizing DSC v3 instructions.

To check a configuration to see what modifications can be made (fairly than shouting Cowabunga on manufacturing methods) run the next command:

dsc config get -f .iis-config.yaml

This command assesses the present state with out making modifications, exhibiting what would occur for those who utilized the configuration.

To use a configuration run a model of the command (together with your yaml file specified):

dsc config set -f .iis-config.yaml

This command applies the configuration outlined within the YAML file to your system.

You could find out extra about DSC v3 on the following places:

https://devblogs.microsoft.com/powershell/get-started-with-dsc-v3/     

https://github.com/PowerShell/PSDesiredStateConfiguration

https://be taught.microsoft.com/powershell/dsc/overview?view=dsc-3.0&preserveView=true    

https://be taught.microsoft.com/en-us/powershell/scripting/set up/installing-powershell-on-windows?view=powershell-7.5 

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles