Microsoft PowerShell Desired State Configuration is a standard component of Microsoft PowerShell, focusing on the deployment and management of configuration data for software services, along with the management of the environment that these systems run on.
Desired State Configuration (DSC) was introduced as part of PowerShell 4.0 and Windows Server 2012 R2. As such, DSC is built in to PowerShell, so it's neither available as a separate line item or as an open source version. It is provided under Microsoft's normal commercial licences.
DSC extends PowerShell with new language extensions, new cmdlets and the capability to use declarative structures to define how a target environment should be provisioned.
Microsoft PowerShell DSC works through creating configurations. These contain the PowerShell scripts required to define and configure instances of resources. The software runs a configuration and then creates an environment that matches the declared state. DSC also ensures that images are idempotent -- the Local Configuration Manager (LCM) keeps machines correctly configured regardless of their state.
Resources are the basic building blocks of PowerShell DSC configurations. Resources model the various components of a subsystem, implementing the control flows of their changing state.
The LCM is the system controller -- it regularly polls the overall environment to ensure that the state laid out in any configuration is maintained. If the LCM recognizes that any system is out of state, it invokes logic, and scripts, to bring the system back into limits.
Microsoft PowerShell DSC can be configured in two basic modes:
- In Push mode, configuration scripts are manually pushed toward the target nodes by a systems administrator.
- In Pull mode, a pull server is created and the nodes automatically poll this on a regular basis to obtain any new configurations, or to maintain an existing configuration. The pull server is an Internet Information Server with an OData interface.
DSC's domain specific language (DSL) is PowerShell -- a good working knowledge of PowerShell is necessary to use the tool. However, there is an active user community for PowerShell that can offer many web-based resources of scripts, templated resources and configurations to help in solving issues the user may encounter. There is no graphical user interface (GUI): DSC is just like PowerShell, as it is essentially a command-line interface tool. However, many programmers have created PowerShell GUIs that are now available on the internet. For example, Dell freely offers its PowerGUI for Microsoft PowerShell DSC.
Through PowerShell scripts, a management object format (MOF) file is created. The MOF file can be created by any means that can be subsumed by DSC: directly via PowerShell -- preferably using the Resource Design tool -- or through commands entered into a file via Notepad and saved as an MOF.
Microsoft PowerShell DSC is not just a Windows tool. As Microsoft has improved its heterogeneous support, particularly around its system management tools, DSC was designed with the capability to also manage Linux as of 2015. To do this, the Open Management Infrastructure Common Information Model server needs to be installed on the Linux target nodes.
DSL for Linux is supported on CentOS, Debian, Oracle Linux, Red Hat Enterprise Linux, Suse Linux Enterprise Server and Ubuntu Server.
Microsoft PowerShell DSC is a good tool choice for configuration management due to its capabilities and also the prevalence of PowerShell skills and the ubiquity of PowerShell and PowerShell DSC as part of Windows Server. Although it does not have a GUI, the large user community and pool of online help resources available makes PowerShell DSC a relatively easy tool to learn. This available support as well as its relatively shallow learning curve and declarative capabilities establish Microsoft PowerShell DSC as a suitable tool for organizations of all sizes.
Learn more about the fundamentals of PowerShell Desired State Configuration
Read about how PowerShell DSC can help to construct a Hyper-V host
Read how the top configuration management tools stack against one another
What are the primary functions of PowerShell DSC?