Sunday, June 1, 2025

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 expertise. In contrast to PowerShell Desired State Configuration (PSDSC) v1.1 and v2, DSC v3 operates as a standalone command quite 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 instrument 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 help for WinGet, making the set up course of extra easy than on earlier server variations. Nevertheless, it is necessary to notice that winget is simply obtainable 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 supplies probably the most easy set up expertise with computerized updates:

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

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

Primary DSC v3 Instructions

To view all obtainable instructions in DSC v3, use:

dsc --help

The output will show obtainable instructions together with:

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

To see the sources obtainable to be used in configurations:

dsc useful resource checklist

This command shows all DSC sources 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. A minimum of one useful resource definition with properties

Making a Primary Configuration

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

$schema: https://uncooked.githubusercontent.com/PowerShell/DSC/principal/schemas/2023/08/config/doc.json
sources:
  - title: Pressure icon view in Management Panel
    sort: 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 traditional icon view.

For compatibility with traditional PowerShell sources, you should use the WindowsPowerShell useful resource sort:

$schema: https://uncooked.githubusercontent.com/PowerShell/DSC/principal/schemas/2024/04/config/doc.json
metadata:
  title: IIS-Configuration
sources:
  - title: Use Home windows PowerShell sources
    sort: Microsoft.Home windows/WindowsPowerShell
    properties:
      sources:
        - title: Internet server set up
          sort: PSDesiredStateConfiguration/WindowsFeature
          properties:
            Title: Internet-Server
            Guarantee: Current

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

As soon as you’ve got created a configuration doc, you’ll be able to check and apply it utilizing DSC v3 instructions.

To check a configuration to see what modifications could be made (quite than shouting Cowabunga on manufacturing techniques) run the next command:

dsc config get -f .iis-config.yaml

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

To use a configuration run a model of the command (along 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’ll find out extra about DSC v3 on the following areas:

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

https://github.com/PowerShell/PSDesiredStateConfiguration

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

https://study.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

PHP Code Snippets Powered By : XYZScripts.com