Improvements to DSC v1

KB3000850, the November 2014 update rollup for Windows RT 8.1, Windows 8.1, and Windows Server 2012 R2, has brought several enhancements and fixes to the first version of DSC (initially released as a part of Windows PowerShell 4.0 in Windows Management Framework (WMF) 4.0).

New cmdlets and functions

Several cmdlets and functions available in the latest WMF 5.0 Preview are now available in the updated WMF 4.0 as well. In the following image the output of Get-Command -Module PSDesiredStateConfiguration from computers running WMF 4.0 both with and without KB3000850 is stored in two variables which are compared using Compare-Object to see the differences:

WMF_V1_Update_img_02

Remove-DscConfigurationDocument – There are configuration documents for various stages in DSC (current.mof, pending.mof, and previous.mof) stored in C:\Windows\System32\Configuration. It can happen that a need to remove one or more of these files arise, for example if a document is corrupted for some reason. It is now possible to use the new Remove-DscConfigurationDocument function to perform this task:

WMF_V1_Update_img_01

Stop-DscConfiguration – If a consistency check was running longer than expected, there wasn’t an easy way to stop the process before this command became available. As the name indicates, it can stop a running configuration.

Update-DscConfiguration – Triggers a pull request from a pull server, and thus only works for pull mode. If a new configuration is available, both the configuration and any dependent DSC Resources will be downloaded and applied. There are also several parameters available for this cmdlet worth looking up in the help system, such as –Wait and –Force.

Updates to existing cmdlets and functions

Using Shay Levy’s script listed in this article, we can quickly see what cmdlets/functions and parameters are added, removed, or changed by KB3000850:

!  > Changed

  • > New

–  > Removed

New-DSCCheckSum (!)

Confirm (+)

WhatIf (+)

Start-DscConfiguration (!)

UseExisting (+)

Remove-DscConfigurationDocument (+)

Stop-DscConfiguration (+)

Update-DscConfiguration (+)

Improvements to existing cmdlets and functions

New-DSCCheckSum – Previously, there was a bug causing this function to fail when specifying an UNC path to the -OutPath parameter. This is now fixed.

Get-DscResource – Previously, this function was very slow to enumerate the available DSC resources. This is now fixed.

Get-DscLocalConfigurationManager – This function now shows more information; among the new properties shown is the LCMState which displays the current state of the DSC engine.

WMF 4.0 without KB3000850:

WMF_V1_Update_img_03

WMF 4.0 with KB3000850:

WMF_V1_Update_img_04

Start-DscConfiguration – Previously the –Force parameter didnt always work correctly, this is now fixed.
There is also a new parameter, -UseExisting, which will apply the configuration document already present in the configuration store.
Previously there wasn
t any cmdlet available to trigger a consistency check, we had to manually start the scheduled task “Consistency” or invoke the appropriate CIM method.
Now the -UseExisting parameter let us perform this task in a more convenient way.

WMF_V1_Update_img_07

Test-DscConfiguration – Previously, this function returned only True or False, making it hard to know what computer is referenced when running against multiple remote computers. It now returns the computer name as a value of the PSComputerName property.

WMF 4.0 without KB3000850:

WMF_V1_Update_img_05

WMF 4.0 with KB3000850:

WMF_V1_Update_img_06

About the author: Jan Egil Ring

Jan Egil works as a Lead Architect on the R&D Team at Crayon, Norway. He mainly works with automation, and has a strong passion for PowerShell. Products and services he works with includes Microsoft infrastructure products such as Windows Server, System Center and Microsoft Azure. He is a multiple-year recipient of Microsoft Most Valuable Professional Award for his contributions in the Windows PowerShell and Cloud & Datacenter Management technical communities. He speaks regularly at user groups and conferences, such as Nordic Infrastructure Conference (NIC), PowerShell Conference Europe and PowerShell Summit. He is a co-founder of the Norwegian Microsoft Technology User Group (MTUG), which is an association of local MTUG user groups in Norway. He is also co-organizing the MTUG Script Club which focuses mainly on PowerShell. You can follow him on Twitter @JanEgilRing.

Related Posts

%d bloggers like this: