PowerShell v4 DSC
PowerShell v4 was released as part of WMF 4 on October 24, 2013, and contained the first released version of DSC. Even though this was the first release of DSC, it is still referred to as being version 4 of DSC. While confusing at first, this is largely something you can ignore, as the versioning of DSC Resources is a more frequent point of variance.
As the first release, this version of DSC largely focuses on bringing a minimally viable product to market for Microsoft. Microsoft is a little late to the DevOps game with DSC, as there are several toolsets out there that have been in use for many years. Puppet and Chef are the most notable, but there are many others. What sets DSC apart here is that it is not an add-on or separate product; it's a core part of the Windows OS and can be used by other tools as much as it can be used by itself.
The first version contains most features needed out of the gate to start automating your deployment process, but only the built in DSC Resources were available and they were lacking in addressing commonly used products such as IIS, SQL, or Exchange. In the early days, Microsoft relied heavily on the community to expand its DSC resource list, which resulted in mixed success. Microsoft released a set of DSC Resources it authored to the community in batches to address the gap. The combination of community and Microsoft contributions has greatly expanded the reach of DSC, and it has been expanding ever since.
v4 DSC language extensions
DSC adds three new functions as language extensions to support declaring the expected state of a machine:
- Configuration: The configuration keyword is a DSC function that declares a set of operations to perform on a target system.
- Node: The node configuration keyword is a DSC function that declares the target host to perform operations on.
- Import-DscResource: It looks like a PowerShell Cmdlet but is really a keyword. It locates the DSC Resources needed to parse and compile the DSC configuration script.
v4 DSC base resources
The following table lists the DSC base resources of v4:
Base resource |
Description |
---|---|
|
The |
|
The |
|
The |
|
The |
|
The |
|
The |
|
The |
|
The |
|
The |
|
The |
|
The |
v4 DSC Cmdlets
Cmdlet |
Description |
---|---|
|
This Cmdlet returns the current DSC configuration status of the node, if the configuration exists. If it does not, this will throw an error. This can also be run on remote systems. |
|
This returns the current settings, or meta-configuration, of the LCM on the system, if the settings exist. This can be run on remote systems and is useful for troubleshooting DSC deployments that use DSC Pull Servers. |
|
This Cmdlet returns a list of all DSC Resources on the system. This is vital in troubleshooting and authoring DSC Resources, as it helps show what resources are present on the system. If the resource you are authoring is not present, then DSC cannot read the resource. |
|
This Cmdlet returns a hash from the DSC configuration MOF file. This is used to deploy MOF files to pull servers. |
|
This Cmdlet removes the compiled MOF from the target node, along with additional cleanup tasks. This Cmdlet is available only as part of the November 2014 update rollup for Windows RT 8.1, Windows 8.1, and Windows Server 2012 R2: http://support.microsoft.com/en-us/kb/3000850 from the Microsoft support library. Before you use this Cmdlet, review the information in What's New in Windows PowerShell: http://technet.microsoft.com/library/hh857339.aspx in the TechNet library. |
|
This Cmdlet restores the previous configuration for the target node, if a previous successful configuration exists on the target node. |
|
This Cmdlet stops a currently running configuration on a target node. This is useful in aborting interactive configuration runs initiated using This Cmdlet is available only as part of the November 2014 update rollup for Windows RT 8.1, Windows 8.1, and Windows Server 2012 R2: http://support.microsoft.com/en-us/kb/3000850 from the Microsoft Support library. Before you use this Cmdlet, review the information in What's New in Windows PowerShell: http://technet.microsoft.com/library/hh857339.aspx in the TechNet library. |
|
This Cmdlet runs the specified configuration against a target node, but does not execute it. It compares the current state of the system to the expected configuration, and reports back if they match. No changes are made to the system using this Cmdlet. |
|
This Cmdlet is used to change the settings, or meta-configuration, on the LCM on the target computer. This is most often used in Pull Server scenarios. |
|
This Cmdlet executes the specified MOF file against the target computer. This is the Cmdlet you will use the most, as it's helpful in both authoring and troubleshooting DSC configurations and DSC Resources. |
|
This Cmdlet is really a dynamic function that is only available at runtime. It specifies which DSC Resources need to be loaded to parse and compile the DSC configuration script. |
The v4 DSC Pull Server
The DSC Pull Server is the management server that the DSC agents on target nodes pull DSC configurations and DSC Resources from. This will be explained in greater detail in Chapter 6, Pulling DSC Configurations.