Use this when declaring Windows or Linux node configuration with PowerShell DSC.
PowerShell DSC
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.
1. PowerShell DSC: declarative configuration for Windows.
2. Configurations compile to MOF.
3. LCM applies and monitors.
4. Resources from modules.
5. DSC v3 is cross-platform and different — check version.
configuration script → MOF → LCM → resources → state
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Target-state verification ladder Verify boundary
PowerShell DSC uses a strict target-state ladder for DSC desired state and resource Test/Set/Get: request accepted → job/task succeeded → target object changed → effective runtime state confirmed → original workload verified.
Step 2 Verification path Verify boundary
Verify the exact DSC version and resource types first, then validate/resolve the configuration document. Run dsc config get to capture current resource state and dsc config test to determine whether it matches desired state. On a controlled target, perform a set only after reviewing the intended differences, then repeat get/test and independently query the underlying OS/application setting that matters to the consumer. Test a deliberately non-converged property and confirm test reports it, and test an invalid resource/input to understand error reporting. Where a resource wraps PowerShell or external tools, capture that resource-specific boundary. A successful dsc config set is intermediate evidence until test/read-back demonstrates the required state.
Step 3 Where it fails Narrow the fault
Separate configuration parsing/schema resolution, DSC engine orchestration, resource discovery/version, resource get/test/set implementation, underlying OS/application API and final consumer-visible state. A configuration can be valid while a resource is missing; a resource can report in-desired-state using incomplete detection; set can succeed while an asynchronous service later fails. Conflicting controllers may cause repeated drift. Do not repeatedly call set until you know why test/get disagree, and do not rewrite desired state merely to match an unexplained target change. Preserve resource-level results and underlying state before remediation. After correction, repeat test/get and the independent service/OS read-back.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
Subtopics
Go one level deeper into this subject.
Desired State Configuration is PowerShell's declarative configuration platform: you describe how a node should look, and the Local Configuration Manager makes it so and keeps checking.
Subtopic ConfigurationA DSC configuration is a PowerShell block that declares resources and their desired properties for nodes, compiled into one MOF file per node.
Subtopic ResourcesDSC resources are the building blocks that manage specific things, such as File, Service, WindowsFeature or community resources, each implementing Get, Test and Set.
Subtopic NodesDSC nodes are the target machines a configuration applies to, listed in the configuration's Node block or in configuration data, each getting its own MOF.
Subtopic MOFMOF files are the compiled output of a DSC configuration, one per node, containing the resolved resource settings the LCM applies.
Subtopic Local Configuration ManagerThe Local Configuration Manager (LCM) is the DSC engine on each node that applies configurations, runs consistency checks and controls refresh mode, frequency and reboot behaviour.
Subtopic Push ModeIn DSC push mode, the configuration is sent to nodes with Start-DscConfiguration.
Subtopic Pull ModeIn DSC pull mode, nodes periodically fetch their configuration and resource modules from a pull server or Azure Automation State Configuration, which scales to many nodes.
Subtopic DriftDrift in DSC is when a node no longer matches its configuration.
Subtopic DSC TroubleshootingTroubleshoot DSC with Test-DscConfiguration -Detailed, Get-DscConfigurationStatus, the Microsoft-Windows-DSC Operational event log, resource module versions on the node and LCM settings.
- Configurations compile to one MOF per node.
- The LCM applies and checks configuration.
- ApplyAndAutoCorrect reverts drift.
Get-DscResource— available resourcesGet-DscConfigurationStatus -All— historyTest-DscConfiguration -Detailed— compliance
ReferenceWhy it matters1 section · depth on demand
In depth
PowerShell Desired State Configuration (DSC) is a declarative configuration platform for Windows (and partly Linux): configurations describe resources and their desired properties, and the Local Configuration Manager applies and monitors them.
| Version | Note |
|---|---|
| DSC 1.1 (Windows PowerShell 5.1) | Built into Windows; LCM push/pull |
| DSC 2 (PSDesiredStateConfiguration module) | For PowerShell 7, used by Azure Machine Configuration |
| DSC 3 | Standalone dsc command, cross-platform, JSON/YAML documents |
Many organisations now use DSC resources through Azure Machine Configuration or Ansible (ansible.windows.win_dsc) rather than running their own pull server.
ReferenceImportant terms & boundaries1 section · depth on demand
Mechanics
Microsoft Desired State Configuration (DSC) is a declarative configuration platform: configuration documents describe desired state and DSC resources implement get/test/set-style operations that inspect and enforce resource state. DSC 3.0 is a standalone cross-platform command-line application and can integrate resources authored in multiple languages; PowerShell DSC resources remain part of the compatibility/ecosystem story. The key boundary is resource ownership: the DSC engine orchestrates resource invocations, but each resource owns how actual state is discovered, compared and changed. A valid document does not show a resource is idempotent or that two resources do not conflict over the same underlying setting. Resource type/schema/version and input values therefore form part of the runtime identity.
ReferenceConfiguration & state1 section · depth on demand
Lifecycle
Keep configuration documents and resource/module dependencies versioned together, including schemas and any resource discovery/install prerequisites. Treat resource versions as behavior dependencies and test upgrades before broad rollout. Define which settings DSC owns so manual tools or other controllers do not continuously fight reconciliation. Secrets should be referenced through an appropriate secure mechanism rather than embedded in plain configuration documents/logs. Use get/test before set in validation flows and schedule convergence according to risk rather than continuously mutating every host. For legacy PowerShell DSC environments, document LCM/pull-server differences separately from DSC 3.0 CLI behavior. Recovery must be able to reconstruct desired configuration from source rather than from an unknown machine state.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in > PowerShell DSC. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://learn.microsoft.com/en-us/powershell/dsc/overview?view=dsc-3.0 · confidence 94%What changed and what may be affected
Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.
Quick lookup tables
→ PowerShell DSC · operational reference
Context-specific ownership, verification, output and failure-boundary lookup for → PowerShell DSC.
| Layer | PowerShell DSC operational reference |
|---|---|
| Runtime/ownership | Microsoft DSC 3.0 / PowerShell DSC compatibility · identify controller/worker/target ownership before mutation |
| Persistent intent | Versioned configuration/playbook/workflow with explicit dependencies and least-privilege identity |
| Verification | dsc config get --file ./config.dsc.yaml; dsc config test --file ./config.dsc.yaml |
| Expected interpretation | The configuration document resolves the intended resources, test reports whether actual state matches desired state, and post-set read-back confirms convergence without assuming the CLI exit alone proves it. |
| Recovery boundary | Preserve correlation IDs + pre-state, then verify target/service independently after remediation |
Deep reference
Healthy vs suspicious evidence
Output interpretation
Prefer DSC structured output over copied human console formatting. Retain configuration document identity/revision, DSC version, resource type/name, operation (get/test/set), per-resource result, changed/in-desired-state indication, error details and underlying target identifiers. For multi-resource documents, one overall exit code can hide which resource diverged, so preserve item-level results. Keep resource stderr/diagnostics separate from declarative state output when wrappers invoke external commands. Redact secrets/protected values while retaining safe property names and hashes where useful. Correlate a set operation with subsequent test/get and external target verification so the audit trail shows convergence rather than only command completion.