Pcornel
Browse topics
Options
Recent
Favorites
Automation · Technical reference

Desired State Configuration

Direct answer

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.

When to use this

Use this to understand how PowerShell DSC declares and enforces node configuration.

First 30 seconds

1. DSC describes desired state; LCM enforces it.

2. Modes: ApplyOnly, ApplyAndMonitor, ApplyAndAutoCorrect.

3. Idempotent resources.

4. Store configurations in git.

5. Report status centrally.

Operational verification

desired state → LCM → test/set resources

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
PowerShell Desired State Configuration
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformPowerShell Desired State Configuration · Automation implementations are tool and platform specific. Use the adjacent Domain for the technology being automated and this Domain for automation behavior. · Windows PowerShell DSC
Key commandTest-DscConfiguration -Detailed
Scope / prerequisiteUse this to understand how PowerShell DSC declares and enforces node configuration.
Troubleshoot · 1
What next?3 suggested next steps
Catalog command links1
Evidence0
On this pageJump to a specific section
Automation command reference

Primary Commands

Configuration and operational commands for this Topic.

Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

5 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Command read-back and what it shows Verify boundary

For PowerShell DSC → Desired State Configuration, read back with Test-DscConfiguration -Detailed. Success is discriminated by the intended node tests compliant for the expected configuration checksum/resources and the original service/configuration acceptance test also passes; failure remains when one or more expected resources report non-compliance, Test throws an error, configuration identity is stale, or DSC is compliant while the original workload remains broken. Test-DscConfiguration -Detailed shows DSC resource compliance results for the assigned configuration at that point, but it does not show all unmanaged settings or application behavior.

Step 2 Verification path Verify boundary

Record node, DSC resource type/name, resource key properties, module version and invocation/run identity; inspect the runtime/control-plane result; then query the managed operating-system/application resource represented by the DSC resource instance through an independent read path and compare it with the versioned intent. For PowerShell DSC → Desired State Configuration, the evidence must connect the control-plane result to the managed operating-system/application resource represented by the DSC resource instance and explain any gap between desired, controller-reported and consumer-visible state.

Step 3 Common mistakes Narrow the fault
  • Assuming DSC is maintained the same way in PowerShell 7 (v3 is separate).
Step 4 Observation-driven branch and next-check logic Narrow the fault

Start PowerShell DSC → Desired State Configuration from one identified target/request/artifact and timestamp. Decision path: if DSC test reports false, identify the exact resource/property before invoking remediation; if test errors, inspect resource/module/credential state; if DSC reports true but workload fails, leave DSC and test the application/service boundary directly.

Step 5 Where it fails Narrow the fault

Failure analysis for PowerShell DSC → Desired State Configuration should follow the path through the components: configuration/document → DSC engine → resource Get/Test → Set when required → resource/OS mutation → Test/Get read-back. Common failure classes include resource module drift, duplicate/ambiguous keys, credentials in artifacts, reboot/pending-state handling, push/pull source drift and resource reporting success without actual convergence. Before retrying a mutating operation, read current target state using the stable identity node, DSC resource type/name, resource key properties, module version and invocation/run identity; if state is unknown, stop broad retries.

Key points
  • DSC declares node configuration.
  • The LCM applies it and checks it.
  • Push or pull delivers it.
Key checks
  • Get-DscLocalConfigurationManager | fl ConfigurationMode,RefreshMode — LCM mode
  • Test-DscConfiguration — compliant?
  • Get-DscConfiguration — current state
ReferenceWhy it matters1 section · depth on demand

In depth

Desired State Configuration describes what a Windows system should look like — features installed, services running, registry values set — as a configuration document. DSC then tests each resource and only sets what is not compliant.

Configuration WebServer {
    Import-DscResource -ModuleName PSDesiredStateConfiguration
    Node 'web01' {
        WindowsFeature IIS { Name = 'Web-Server'; Ensure = 'Present' }
        Service W3SVC { Name = 'W3SVC'; State = 'Running'; StartupType = 'Automatic'; DependsOn = '[WindowsFeature]IIS' }
    }
}
WebServer -OutputPath C:\DSC\WebServer
Start-DscConfiguration -Path C:\DSC\WebServer -Wait -Verbose

Each resource implements Get, Test and Set, which is what makes DSC idempotent.

ReferenceHow it works1 section · depth on demand

How it works

PowerShell DSC → Desired State Configuration owns the desired DSC document assigned to the node, current resource state and the Test/Get/Set contract used by each DSC resource to decide compliance. LCM invokes resource Test logic against current state and compares it with desired properties; only resources reporting non-compliance should require Set behavior under the configured consistency mode. Keep these adjacent boundaries separate: resource module implementation, reboot requirements, credentials, pull mode and external services are separate dependencies. A key diagnostic distinction is that a True compliance result means resource Test methods agree at that moment, not that every application-level invariant or unmanaged setting is correct.

ReferenceImportant terms & boundaries1 section · depth on demand

Mechanics

PowerShell DSC → Desired State Configuration is owned at runtime by the PowerShell DSC engine/resource invocation that evaluates desired state against a node. Its durable intent is versioned DSC configuration/document/resource settings and module/resource versions; the stable identity contract is node, DSC resource type/name, resource key properties, module version and invocation/run identity. The consumer-visible target is the managed operating-system/application resource represented by the DSC resource instance. The operating invariants are that resource identity is stable, Get/Test/Set semantics agree, module/schema versions are known, secrets are protected, and convergence is verified from actual resource state. Follow the chain of components configuration/document → DSC engine → resource Get/Test → Set when required → resource/OS mutation → Test/Get read-back and record which layer currently owns truth. The linked authority for bounded mechanics is Microsoft Learn — Desired State Configuration overview; documentation support is separate from observed lab/production Evidence.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docPowerShell Desired State Configuration current

Authoritative/upstream documentation reviewed for bounded claims in PowerShell DSC > Desired State Configuration. 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%
Depth when you need it

Deep reference

Healthy vs suspicious evidence

Output interpretation

Capture at minimum node, resource type/name/key, module/version, desired properties, Test result, Set result/error and final Get/read-back state.

Confirmation

Confirm action

Continue?