In the previous chapter, we covered the basics of Desired State Configuration; this chapter is a continuation of the same.
To learn DSC, you would need to watch the video in Microsoft Virtual Academy.
Here are some useful links:
To get started with Windows PowerShell Desired State Configuration (DSC)— http://www.microsoftvirtualacademy.com/training-courses/getting-started-with-powershell-desired-state-configuration-dsc-
For advanced PowerShell Desired State Configuration (DSC) and custom resources—http://www.microsoftvirtualacademy.com/training-courses/advanced-powershell-desired-state-configuration-dsc-and-custom-resources
DSC—Desired State Configuration—is a Windows PowerShell extension released with Windows Management Framework 4.0. DSC is a fast-growing technology. Any IT professional or developer responsible for configuration management automation needs DSC. In this chapter, we will cover the following topics:
DSC needs a supporting PowerShell version, which is version 4.0, and operating system from Windows 2008 R2 onwards. DSC is built on CIM and needs the WinRM listeners, service, and script execution policy.
Let's set up a machine to jump-start DSC. Here, we will use a machine working on the Windows Server 2008 R2 operating system with SP1, and the PowerShell version is 2.0. Perform the following steps:
Let's take a look at the .NET framework version installed on the Windows 2008 R2 SP1 box from the registry using PowerShell. Run the following command for this:
Get-ItemProperty 'HKLM:SOFTWAREMicrosoftNET Framework SetupNDPv4Client'
The output is illustrated in the following image:
You can also install the .NET Framework 4.5 first and then check the version after successful upgrade of .NET Framework by executing the code mentioned before, which shows the version as 4.5.50709. The machine we will use for this demo doesn't have Windows PowerShell ISE installed, so let's enable the feature using the following PowerShell code:
Import-Module ServerManager -Verbose Get-WindowsFeature -Name '*ISE*' -verbose Add-WindowsFeature -Name 'PowerShell-ISE' -Verbose
Yeah! It's done. Take a look at the following image:
Install the WMF 4.0 MSU file; you can refer to the steps used for this in Chapter 1, Getting Started with Windows PowerShell. This installation requires a reboot, so plan according to your production environment. Take a look at the following image:
After the reboot, PS will be upgraded to version 4.0, and we can take a look at the PSDesiredStateConfiguration
module, as shown in the following image:
We have now successfully installed Windows Management Framework 4.0; in the next chapter, we will discuss the steps to upgrade WMF to version 5.0, the April 2015 preview, using DSC.