Practicing and exploring

Time to test your knowledge and understanding by performing exercises and answering some questions. Get your hands dirty with the following exercises.

1

Verify your Microsoft DSC installation

Easy

Confirm that Microsoft DSC is properly installed and accessible from your command line, and document your system configuration.

Your Task

Complete the following verification steps:

  • Run dsc --version and record the version number
  • Run each DSC command and name the available options (except for --version and --help)
  • List out the available DSC functions and count how many are available
  • Document your OS, architecture, and edition using a DSC resource
Hints
  • If the command is not found, check your PATH environment variable
  • On Windows, you may need to restart your terminal after adding to PATH
2

Create registry management script

Medium

Build a PowerShell script that manages registry keys using the Microsoft.Windows/Registry resource with full CRUD operations and driven behavior using parameters.

Your Task

Create a PowerShell script that:

  • Accepts parameters for operation type (get, set, test, delete)
  • Creates a registry key with _exist = $true when using set
  • Implements get operation to retrieve current registry key state
  • Implements test operation to verify if key exists and matches desired state
  • Implements delete operation when _exist = $false is specified
  • Uses the Microsoft.Windows/Registry DSC resource
  • Includes error handling and validation
  • Provides clear output showing the operation result in PowerShell objects
Hints
  • Use a [ValidateSet] attribute for the operation parameter
  • Build the JSON input dynamically based on the operation
  • Use ConvertFrom-Json to parse DSC output for better handling
  • Remember: delete requires setting _exist to false in the input
  • Test your script with HKCU hive to avoid needing admin privileges
3

Knowledge check

Easy

Test your understanding of core Microsoft DSC concepts, architecture, and how it differs from traditional configuration management tools.

Questions
  1. What does DSC stand for, and what problem does it solve in configuration management?
  2. How does DSC differ from imperative configuration tools?
  3. What does it mean when we say DSC is idempotent?
  4. What's the role of a DSC Resource?
  5. How do DSC configuration documents describe the desired state of a system?
  6. What are the main operations supported by DSC resources?
  7. How is DSC different from PowerShell DSC in terms of dependencies and architecture?
  8. What formats can DSC configuration documents be written in?
  9. Why doesn't the new DSC include a Local Configuration Manager?