- Courses
- đź’»Programming Languages
- 🪟PowerShell
- PowerShell Scripting at Scale
- Desired State Configuration (DSC)
- The Purpose of DSC
On this page
PowerShell Declarative State Configuration Purpose
Updated on June 24, 2026
By Enrico Hochkoeppler
Web Developer & TutoriaLibre Founder
Desired State Configuration (DSC) is a configuration management platform that enables declarative, idempotent, and scalable system configuration across Windows, Linux, and macOS environments. DSC eliminates configuration drift by allowing administrators to define the desired state of a system and ensuring that the system continuously conforms to that definition. Built on three primary components—Configurations (declarative PowerShell scripts), Resources (modules that enforce state), and the Local Configuration Manager (LCM) (the engine that applies and maintains configurations)—DSC transforms infrastructure management from error-prone manual processes into predictable, repeatable automation. Whether deployed in push mode for testing or pull mode for enterprise-scale management, DSC provides the foundation for configuration as code in modern IT environments.
Why DSC Exists​
Traditional system administration relies heavily on imperative scripting—step-by-step instructions that tell a system what to do. This procedural approach has significant limitations:
- Scripts must be rerun manually after each change
- Scripts can fail midway, leaving systems in inconsistent states
- Scripts do not automatically detect or correct configuration drift
- Scripts are often environment-specific and difficult to reuse
DSC addresses these challenges by shifting from procedural automation to declarative configuration. Instead of writing instructions on how to configure a system, DSC allows administrators to describe what the system should look like. The DSC engine handles the rest.
DSC helps eliminate configuration drift and ensures the state is maintained for compliance, security, and performance. It provides powerful management capability for infrastructure, both on-premises and in the cloud, introducing a declarative syntax into PowerShell and a built-in engine that receives and applies configurations.
The Core Idea: Declarative Configuration​
At its heart, DSC is built on a declarative model. A DSC configuration defines the desired state of a system. For example, you can declare:
- A Windows feature must be installed
- A service must be running
- A file must exist with specific contents
- A registry key must have a specific value
- A user or group must be present
DSC then ensures that the system matches this declared state. Unlike imperative tools, with DSC the definition of an application environment is separate from the programming logic that enforces that definition. The DSC command-line application abstracts the management of software components declaratively and idempotently.
If something changes—such as a service being stopped or a registry key being modified—DSC can automatically detect and correct the deviation. DSC configurations can be used to correct configuration drift when it occurs or simply report on it.
The Three Pillars of DSC​
DSC consists of three primary components:
Configurations​
Configurations are declarative scripts—traditionally PowerShell scripts, though modern DSC supports JSON and YAML configuration documents—that define and configure instances of resources. Upon running the configuration, DSC applies it, ensuring that the system exists in the state defined by the configuration.
DSC supports writing configuration documents in both JSON and YAML, making them accessible even to readers who are not subject matter experts. Example scenarios include defining requirements for an application environment or specifying operational and security standards.
Resources​
Resources contain the code that puts and keeps the target of a configuration in the specified state. Resources are packaged in PowerShell modules and can be as generic as a file or a Windows process, or as specific as an IIS server or an Azure VM.
DSC Resources define how to manage state for a particular system or application component. Every resource can be used with Get and Test operations to retrieve the current state of a resource instance and validate whether it is in the desired state. Most resources also support enforcing the desired state with the Set operation.
Local Configuration Manager (LCM)​
The Local Configuration Manager (LCM) runs on the nodes or machines you wish to configure. It is the engine by which DSC facilitates the interaction between resources and configurations.
The LCM regularly polls the system using the control flow implemented by resources to maintain the state defined by a configuration. If the system is out of state, the LCM calls the code in resources to apply the configuration according to what is specified. After a configuration is delivered and applied, it can be used to correct configuration drift or report on it.
Ensuring Consistency at Scale​
In enterprise environments, configuration drift is a constant challenge. Examples include:
- A service stopped by accident
- A registry key modified by an application
- A feature uninstalled during troubleshooting
- A file overwritten or deleted
DSC continuously checks the system and restores the correct state. This makes DSC ideal for:
- Server farms
- Domain controllers
- Web servers
- Application servers
- Compliance-sensitive systems
- Any environment where consistency is critical
DSC ensures that every machine remains configured exactly as intended. PowerShell DSC enables you to manage, deploy, and enforce configurations for physical or virtual machines, including Windows and Linux systems.
Idempotence: A Key Property​
DSC configurations are idempotent. This means that running the same configuration multiple times produces the same result. The LCM will ensure that machines are configured in whatever state the configuration declares, regardless of how many times the configuration is applied.
This is essential for predictable automation. Whether you apply a configuration once or a hundred times, the system ends up in the same state. DSC configurations check to see if settings are already appropriately configured before reapplying them. Server roles and features can be installed or removed on target computers without refresh-time errors due to their already being present or absent.
DSC Implementation Methods​
There are two primary methods of implementing DSC:
Push Mode​
In push mode, a user actively applies a configuration to a target node and pushes out the configuration. This method is useful for testing and immediate configuration application.
Pull Mode​
In pull mode, pull clients are automatically configured to get their desired state configurations from a remote pull service. This remote pull service is provided by a pull server that acts as central control and manager for the configurations, ensures that nodes conform to the desired state, and reports on their compliance status.
The pull server can be set up as an SMB-based pull server or an HTTPS-based server. The HTTPS-based pull server uses the Open Data Protocol (OData) with the OData Web service to communicate using REST APIs. This is the preferred model, as it can be centrally managed and controlled.
DSC as Part of Modern Configuration Management​
DSC integrates with modern infrastructure management tools and platforms, including:
- Azure Automation State Configuration
- Configuration management tools (Chef, Puppet, Ansible)
- CI/CD pipelines
- Infrastructure-as-Code workflows
Microsoft DSC 3.0 is a standalone product that provides true cross-platform support and is not dependent on PowerShell, though you can still use your existing PowerShell DSC resources. DSC 3.0 supports resources written in bash, Python, C#, Rust, or any other language. New DSC resources define their schemas with JSON or YAML files, and configuration documents are defined in JSON or YAML files rather than PowerShell script files.
Summary​
The purpose of Desired State Configuration is to provide a reliable, declarative, and scalable way to manage system configurations. DSC ensures that:
- Systems remain in a known, compliant state
- Configuration drift is detected and corrected
- Administrators can define configurations once and apply them everywhere
- Automation becomes predictable, repeatable, and maintainable
- Infrastructure is managed as code
DSC is a cornerstone technology for large-scale PowerShell automation and modern infrastructure management. Whether using legacy PowerShell DSC or the new cross-platform DSC 3.0, the principles remain the same: declare the desired state, let the engine enforce it, and eliminate configuration drift at scale.
Found this helpful? Share the knowledge...
... or support this project to keep it alive!
Previous
Desired State Configuration (DSC)
Next
Declarative Configuration
-
Why DSC Exists
-
The Core Idea: Declarative Configuration
-
The Three Pillars of DSC
- Configurations
- Resources
- Local Configuration Manager (LCM)
-
Ensuring Consistency at Scale
-
Idempotence: A Key Property
-
DSC Implementation Methods
- Push Mode
- Pull Mode
-
DSC as Part of Modern Configuration Management
-
Summary
