Desired State Configuration – Creating a configuration file for DSC

Hi,

Desired State Configuration (DSC) is a new feature that was introduced with PowerShell 4.
It enables you to deploy configuration data to clients in or outside your network.

In some aspects DSC can be compared to GPO, except that it can be used to configure Linux and Mac clients.
Windows support is native but you can download new Resources to use with Linux and Mac.

DSC uses a few components to perform the configuration you want.
First you need the configuration file that specifies how to identify a node and what that node should do.
This file will be used to create a MOF-file for each node that will receive this configuration.
A node is a client you want to configure.

Second thing you need is a resource that explains how to perform the configuration when it has been downloaded to the node.
The Resources that come with DSC are Registry, Script, Archive, File, WindowsFeature, Package, Environment, Group, User, Log, Service, and WindowsProcess.
They can be used to perform different actions and you can read more about them here.
You can create your own resources but we will cover that later.

Lets get stared with the configuration file.
This configuration file specifies that the server SERVER01 should have the WDS-role installed.

Configuration NianIt_Servers
{
    # Nodes can be specified using parameters. There can be more than one Node-block in the config file.
    Node SERVER01
    {
        # You can specify one or more resource blocks
        # WindowsFeature is one of the resources you can use in a Node block
        # This example ensures the Windows Deployment Service role is installed
        WindowsFeature WDS
        {            
            Ensure = "Present" # To make sure that the feature is not installed you can change Ensure to "Absent"
            Name = "WDS" # Use Get-WindowsFeature to get the feature name form the "Name" property. 
        }
    }
}
NianIt_Servers -OutputPAth C:\DSC

In the next post we will create a MOF-file for SERVER01 and deploy it by pushing it to the server.

Leave a Reply

Your email address will not be published. Required fields are marked *