PowerShell Version 5 New Feature: New Parameters added to the New-DscCheckSum and Test-DscConfiguration Cmdlets

I’m continuing on my series of blog articles on the new features in the preview version of PowerShell version 5. Today I’ll be discussing the existing DSC (Desired State Configuration) cmdlets in PowerShell version 4 that now have new parameters as of the May 2014 preview version of PowerShell version 5.

To begin, I’ll define a DSC configuration that’s parameterized so that it’s reusable:

ps5-dsc1a

Run the configuration specifying the computer names to create MOF files for:

ps5-dsc2

In the preview version of PowerShell version 5,  the New-DscCheckSum cmdlet now has a WhatIf parameter:

ps5-dsc3

A Confirm parameter has also been added to the New-DscCheckSum cmdlet:

ps5-dsc4

Verify the state of the specific features and services on the servers:

ps5-dsc5

Apply the DSC configuration:

ps5-dsc6

Check the status of the features and services again:

ps5-dsc7

Test the DSC configuration using the Test-DscConfiguration cmdlet:

ps5-dsc8

Note: In the previous example, the CimSession parameter is used even though there isn’t a CimSession to SQL01 and WEB01. The computer names can simply be specified in this scenario. This isn’t a new feature as this works in PowerShell version 4 as well, but it is something to be aware of so that you don’t necessarily have to create a CimSession first.

Detailed parameter has been added to the Test-DscConfiguration cmdlet in the PowerShell version 5 preview:

ps5-dsc9

ps5-dsc10

This blog article has been written based on the preview version of PowerShell version 5 from the May 2014 release of the Windows Management Framework 5.0 preview so what you’ve seen here is subject to change in the final release version.

This blog article is one of many that I’ve written and will be writing about the new features in PowerShell version 5. You can find my other blog articles on PowerShell version 5 here.

µ

Leave a Reply

%d bloggers like this: