Pcornel
Automation

PowerShell DSC

Cheat sheet · https://pcornel.dk/topic.php?topic=5675

Back to the Topic

Answer

PowerShell DSC (Desired State Configuration) declares how a Windows or Linux node should be configured using resources in configuration scripts, compiled to MOF files and applied by the Local Configuration Manager.

Remember

  • Configurations compile to one MOF per node.
  • The LCM applies and checks configuration.
  • ApplyAndAutoCorrect reverts drift.

First checks

  • Get-DscResource — available resources
  • Get-DscConfigurationStatus -All — history
  • Test-DscConfiguration -Detailed — compliance

Commands

test
Expected interpretation

Verify in this order

configuration script → MOF → LCM → resources → state

Where it usually breaks

Automation/controller success is not target-state proof; target config/state is not effective-runtime proof; effective state is not workload proof.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5675

Confirmation

Confirm action

Continue?