Home > Articles > Software Development & Management

  • Print
  • + Share This
This chapter is from the book

Configuring the DSC Environment

Don’t even think about testing, much less deploying, DSC unless all of the following are true:

  • All participating computers have WMF 4.0 or later installed.
  • All participating servers have Windows PowerShell remoting enabled.
  • All Windows Server 2012 R2 and Windows 8.1 nodes have hotfix KB2883200 installed.

You can leverage Windows PowerShell to verify if that required hotfix has been applied to your system:

PS C:\> Get-HotFix -Id KB2883200

Source        Description      HotFixID     InstalledBy        InstalledOn

------        -----------      --------     -----------        -----------

DSCSERVER01   Update           KB2883200    COMPANY\trainer    9/30/2013 

Windows PowerShell remoting is required because the deployment of DSC MOF files uses Web Services-Management / Windows Remote Management (WS-Man/WinRM).

You also need to enable the DSC bits on all participating nodes. (Nodes is a more descriptive term than server because technically DSC can be used in both server and desktop Windows versions.) From an elevated Windows PowerShell console prompt on a Windows Server box, you can run the following:


Of course, we can also use Server Manager (on servers) or Windows Features (on clients) to enable DSC, as shown in Figure 18.3.

Figure 18.3

Figure 18.3 Here we enable Windows PowerShell DSC in Windows Server 2012 R2 (top) and in Windows 8.1 (bottom).

Loading Up DSC Resources

As of this writing, Microsoft gives us 12 in-box resources in WMF v4. These resources and their uses are as follows:

  • Archive: Zipping and unzipping archives
  • Environment: Managing environment variables
  • Group: Managing local groups
  • Log: Writes messages to the Microsoft-Windows-DSC/Analytic event log
  • Package: Installs .msi or Setup.exe software
  • Registry: Managing the computer and user Registry hives
  • Script: Excellent as a “catchall” resource when you can’t get what you need from an existing DSC resource
  • File: Managing files and folders
  • WindowsProcess: Controlling process objects
  • WindowsFeature: Managing server roles and features
  • Service: Controlling service objects
  • User: Managing local users

If you run the following command:

Get-DSCResource | Select-Object { $_.parentpath }

you’ll see that your built-in DSC resource folders are placed deep in the Windows\system32 hierarchy:


That’s all well and good, but when you need to install your own modules, you should place them in this path:

C:\Program Files\WindowsPowerShell\Modules

Specifically, you should place the unzipped resource folder directly inside Modules. For instance, in Figure 18.4, I show you where I placed the xActiveDirectory experimental module that I downloaded to my server via OneGet.

Figure 18.4

Figure 18.4 Here we see where to place additional DSC resources on a node’s file system. Notice that a DSC resource looks and “feels” an awful lot like a traditional Windows PowerShell script module.

If your nodes are equipped with PowerShell v5 preview (which they shouldn’t unless v5 has been finalized as of your reading this), I suggest you look for DSC resources by querying the repositories:

Get-Package -Name x*

The x prefix is used to denote prerelease or eXperimental resource packages. Therefore, you use them in production at your own risk.

DSC Resource Waves

Aside from OneGet repos, your best bet for discovering useful DSC resources are the DSC Resource Kit “waves” that are regularly released by the Windows PowerShell team. Each wave brings new resources to the table that allow you greater administrative control over more and more products. Sometimes you’ll find that a newer wave release includes updated resources that supersede previously released versions. (The x in experimental is taken very seriously by the PowerShell community.)

Sadly, the DSC resource kit waves aren’t presented in a strictly linear fashion, which can make it tricky figuring out what’s what. To help you along, I’ll pass on the links for the nine wave announcements that are extant as of this writing:

Again, you simply download the resources, unzip them into the proper directory, and run Get-DSCResource to verify that they show up. Recall also that you need to install the resources on all participating nodes.

  • + Share This
  • 🔖 Save To Your Account