PowerShell v4 Desired State Configuration Deep Dive

During my time at Microsoft TechEd many new things were announced. My all time favorite announcement was PowerShell v4. There are many great things coming out with PowerShell v4, things that I haven’t really gotten a chance to dig into much yet. However the one of the few things I have run through would be the Desired State Configuration which I will refer to as DSC throughout this blog.

DSC is a way to manage the configuration for multiple servers utilizing a single script for the deployment. In the example I will use is managing an IIS Configuration across multiple servers. However as the DSC is developed there will be other usability options for this.

Step Outline:

The DSC requires a couple of steps. It isn’t just a single script you create and execute; but it is very close.

  1. Create a DSC script.
  2. Execute DSC script to create DSC file (MOF File).
  3. Deploy and enact Desired State Configuration file to server(s)

Step 1: Creating a Desired State Configuration File

The first step, in utilizing the DSC is creating the DSC Script. This script is used to generate the DSC file which is a MOF document. To create the DSC Script you can simply open the PowerShell ISE and start writing PowerShell utilizing a couple of new keywords and identifiers.

You will notice in the below example script the keyword configuration, with a nested identifier of Node.