DevOps: PowerShell Desired State Configuration
Author: jason
Date: 2015-09-01 10:55:57
Category: Technical

The PowerShell Desired State Configuration (DSC) feature is a pretty cool way to summarize the state you want a server to be in. Execute the script, and the Local Configuration Manager (LCM) handles getting the server to that state.

PS/DSC is available with PowerShell v4.0. Windows 2008 R2 servers need to have the Windows Management Framework 4.0 installed. Windows 2012 R2 server come with it by default.

For instance, with DSC we can specify the Web Server feature must be present, instead of specifying how and where to get/install the Web Server.


WindowsFeature IIS {
Name = "Web-Server"
Ensure = "Present"

There are 2 parts of the PS/DSC. The Configuration and the Config Data (Environment). The Configuration is how we want the server to be. The Config Data is the server(s) we want to do it to.


# This is where we specify the servers we want to execute against
$ConfigurationData =
AllNodes =
NodeName = "localhost" # or some servername
} # end config data

# This sets up the "state" we want those above servers to be in
Configuration QuickTest {

# Start configuration actions
Node $AllNodes.NodeName {

File MakeTemp
Ensure = "Present"
Type = "Directory"
DestinationPath = "c:temp"
} # end state

} # end node

} # end config

# This makes the MOF file(s)
QuickTest -ConfigurationData $ConfigurationData –Verbose

# This runs the MOF file
Start-DSCConfiguration -Wait -Force -Verbose -Path .QuickTest

DSC Overvier:
Get Started with PS/DSC:
Info about DSC:
More DSC:
Windows Management Framework 4.0 Download:
Windows Management Framework 5.0 Preview Download:
WinMF 5.0 Preview:
More DSC:

jason @ - - copyright 2009