Useful Resources to Teach Yourself PowerShell DSC
Published on 10 Dec 2014Tags #Desired State Configuration #DSC #PowerShell #PSDSC
When learning about DSC you will likely read dozens of articles and try to make sense of them. I will give you a head start and point you to the most helpful articles that I have used in the past.
Also make sure that you come back to look through my posts about PowerShell Desired State Configuration.
Topics
Fundamentals
-
TechNet: Windows PowerShell Desired State Configuration Overvie
The documentation provides by TechNet library provides a very valuable introduction to DSC. I recommend that you flip through the pages before consulting the other links in this article.
-
Building Clouds: Introducing PowerShell Desired State Configuration
This post is a very condensed introduction to DSC.
-
PowerShellOrg: The DSC Book
Don Jones and Steven Murawski have written an extensive book about Desired State Configuration which provides a great starting point as well as a reference for experienced devops.
-
PowerShell Team Blog: Push and Pull Configuration Modes
DSC can operate in push and pull mode. This article provides a detailed description of both modes and how to use them.
-
Darren Mar-Elia: Group Policy vs. Desired State Configuration vs. …
This post discusses DSC in the context of group policies
Meta Configurations
-
Petri: Desired State Configuration and Local Configuration Manager
This post provides an introduction to the LCM
-
PowerShell.org: Configuring a Desired State Configuration Client
The Local Configuration Manager accepts a list of options to tweak it’s behaviour.
-
Petri: Desired State Configuration Host Deployment - Local Configuration Manager
In addition to the options accepted by the LCM, this post also covers the configuration ID.
-
PowerShell Team Blog: Understanding Meta Configuration in Windows PowerShell Desired State Configuration
The LCM checks and applies configurations based on the configuration as well as the refresh frequency. This post describes how the LCM behaves in push and pull mode.
Node Configurations
-
PowerShellOrg: Building a Desired State Configuration Configuration (Part 1 and Part 2)
Steven Murawski provides a step-by-step introduction to writing configurations.
-
Petri: What Can I Configure Using Desired State Configuration?
This post provides a list of all resource included with PowerShell by default and offers an example for each of them.
-
TechNet: Separating Configuration and Environment Data
There are two approaches to writing configurations. The first involves parameters for a configuration that need to be supplied on the command line. The second separates the configuration from the environment data.
See also my post about this.
-
PowerShell Team Blog: Separating “What” from “Where” in PowerShell DSC
As above but this post is a lot more practical.
See my post comparing different appraoches to writing DSC configurations: Are You Separating Configuration and Environment Data in PowerShell DSC? You Should!
-
Creating a DSC Configuration Template
The author presents a function to generate a template containing sections for all resources present on the current system.
-
PowerShell Team Blog: Creating a Secure Environment using PowerShell Desired State Configuration (complex example creating a secure environment with DSC and JEA)
This article describes how to secure your environment using Just Enough Admin (JEA) and includes a lot of DSC examples.
-
PowerShell Team Blog: Reusing Existing Configuration Scripts in PowerShell Desired State Configuration
Long configuration are a complex beast. This article describes how to build configurations that are reusable.
Unfortunately, it is not trivial to inject meta and node configurations into virtual hard disks. See my post Why Injecting a PowerShell DSC Meta Configuration is not Enough
Pull Server
-
TechNet: Windows PowerShell Desired State Configuration Pull Servers
This is the original documentation of a pull servr by Microsoft
-
Petri: Deploying a Desired State Configuration Web Host Using PowerShell
How to build a pull server using PowerShell commands
-
Petri: Deploying a Desired State Configuration Web Host Using DSC
How to build a pull server using PowerShell DSC
-
Building Clouds Blog: PowerShell DSC Resource for configuring Pull Server environment
Inside the DSC resource (DSCService) that takes care of building a pull server
Mind that the current (Wave 8) implementation of the DSC resource for the pull server does not work on locales other than en_*. See my post Setting up a Desired State Configuration Pull Server with Non-English Locales.
-
Building Clouds Blog: Deploying a pull service endpoint and automating the configuration of the DSC nodes
How to configure the LCM to connect to a pull server
-
Petri: How to Publish a Desired State Configuration
How to work with GUIDs for nodes connecting against a pull server
-
PowerShell Team Blog: How to Deploy and Discover Windows PowerShell Desired State Configuration Resources
How to deploy DSC resources through the pull server so that nodes can load them on demaond
-
Jacob Benson: PowerShell Desired State Configuration (DSC) Journey – Day 27
As above but more practical
-
Building Clouds Blog: Working with the conformance endpoint
When nodes interact with the pull server, some information about their state is stored for analysis
-
PowerShell Team Blog: How to retrieve node information from DSC pull server
Additional information about the conformance endpoint
-
Scripting Guy: Configure SMB Shares with PowerShell DSC
Instead of an IIS-based pull server, DSC also supports pulling configurations from a SMB share.
Credentials
See my post about Handling Plain Text Credentials in PowerShell DSC
-
TechNet: Securing the MOF file
This page provides a detailed description how to use certificates to secure credentials in MOF files.
Debugging
-
PowerShell Team Blog: Using Event Logs to Diagnose Errors in Desired State Configuration
The event log contains a wealth of information about DSC and what’s going on behingd the covers.
-
PowerShell Team Blog: DSC Diagnostics Module– Analyze DSC Logs instantly now!
The DSC resource xDscDiagnostics exports two very useful cmdlets called Get-xDscDiagnostics and Trace-xDscDiagnostics which are both very helpful in tracing errors.
-
PowerShell Team Blog: Debug Mode in Desired State Configuration
Enabling debug mode of the Local Configuration Manager disabled resource caching which makes resource development easier.
Custom Resources
-
PowerShell.org: Building Desired State Configuration Custom Resources
This article provides a nice introduction what a custom resource looks like.
-
Petri: How Do I Create My Own Desired State Configuration (DSC) Resource?
Damian Flynn describes how to plan a custom resource
-
Petri: Where Do I Add the Code for My Desired State Configuration (DSC) Module?
Building on the previous article, Damian Flynn continues to explain custom resources
-
TechNet Library: Build Custom Windows PowerShell Desired State Configuration Resources
This article offers insight about the structure of a custom resource and presents a prototype for the test, get and set functions.
-
PowerShell Team Blog: Resource Designer Tool – A walkthrough writing a DSC resource
After reading the areticle above, this tutorial will teach you how to write your own custom resource.
-
Building Clouds Blog: The case of the “Silly” DSC custom resource
This post demonstrates how to write your own custom resource by using a hands-on approach.
-
Building Clouds Blog: Writing a custom DSC resource for Remote Desktop (RDP) settings
This article also demonstrates writing a custom resource for configuring Remote Desktop Services.
-
Building Clouds Blog: Authoring DSC Resources when Cmdlets already exist
In many cases, you already have a set of PowerShell cmdlets that you are planning to wrap in a DWSC resource. This article will provide you with the necessary guidance.
-
Building Clouds: Testing DSC Resources
When writing your custom DSC resource you will want to test that it is working as designed.
-
PowerShell Team Blog: PowerShell DSC Resource Design and Testing Checklist
Valuable hintw for designing and testing custom resources.
Features in WMF 5.0
-
PowerShellMagazine: Inter-node dependency and cross-computer synchronization with DSC
In version 5 of the Windows Management Framework (which includes PowerShell 5), DSC is able to synchronize configurations between nodes. This allows for enhanced deployments to be created using DSC.
-
PowerShellMagazine: Partial DSC Configurations in Windows Management Framework (WMF) 5.0
Instead of a single configuration per node, PowerShell 5 enables configurations to be split among different specialists.
-
PowerShellMagazine: Class-defined DSC resources in Windows Management Framework 5.0 Preview
A new way to define DSC resources in WMF 5
Sites
In contrast to the posts above - which focus on a certain topic - Jacob Benson’s blog features many posts about his journey with Desired State Configuration. So instead of pointing to individual posts, you need to read through most of the posts. They contain a wealth of information about writing and deploying configurations.
Hans Vredevoort maintains the #WAPack Wiki which contains an extensive section about PowerShell DSC with numerous articles.
Learning about DSC Resources
Microsoft maintains a documentation of all DSC builtin resources shipped with Windows Server 2012 R2 and younger. Additional DSC resources are published in waves in TechNet Gallery.You can retrieve all available DSC resources with the following command:
Get-DscResource
The following command displays all properties for the registry resource:
Get-DscResource -Name Registry | Select-Object -ExpandProperty Properties