Use this to understand how PowerShell DSC declares and enforces node configuration.
Desired State Configuration
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.
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.
desired state → LCM → test/set resources
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Test-DscConfiguration -DetailedPrimary Commands
Configuration and operational commands for this Topic.
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 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.
- DSC declares node configuration.
- The LCM applies it and checks it.
- Push or pull delivers it.
Get-DscLocalConfigurationManager | fl ConfigurationMode,RefreshMode— LCM modeTest-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.
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 > 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%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.