Desired State Configuration (DSC) is the next phase in the development of Windows Power-Shell, a process that began over a decade ago and first appeared as a Windows component in Windows PowerShell 1.0 (released in 2006). Windows Server 2012 expanded the functionality of Windows PowerShell by using the command line infrastructure as an underlayment for all of the new graphical capabilities in the operating system. Windows PowerShell 3.0 added thousands of new cmdlets, making it possible to use the command line to accomplish any
task you might otherwise perform in Server Manager.
In Windows PowerShell 4.0, DSC provides a new scripting model that enables administrators to create modules called configurations, which consist of nodes representing computers and resources that define elements that administrators want to define as part of the configuration for a particular node.
For example, a relatively simple script to deploy a Web server might appear as follows:
Ensure = “Present”
Name = “Web-Server”
Ensure = “Present”
Type = “Directory“
Recurse = $true
SourcePath = $WebsitePath
DestinationPath = “C:\inetpub\wwwroot”
Requires = “[WindowsFeature]InstallIIS”
In this script, the Node block identifies the computer to be configured and the WindowsFeature and File blocks are both built-in resources that you can use to define the configuration you want to deploy. The WindowsFeature block specifies that the configuration must install the Web-Server role, and the File block copies the content files for a website to the node from a location defined by the $WebsitePath variable. DSC includes many other built-in resources that you can use to define more complex configuration elements, such as system services, registry settings, environment variables, and user and group accounts. It is also possible for administrators to create their own custom resources.
Once you have created a configuration script, you can deploy it by executing the defined configuration name—in this case CompanyWeb—from a Windows PowerShell prompt.
In large enterprise deployments, administrators can create a centralized DSC server by installing the PowerShell Desired State Configuration Service, a Windows PowerShell feature that uses the Internet Information Services Web server to deploy configuration logic and data to nodes all over the network. After storing DSC configuration scripts on the server, administrators can configure nodes to check periodically for changes in their configurations or configure the server to push new configurations to nodes as needed.
This article is a part of 70-410 Installing and Configuring Windows Server 2012 Prep course, more articles in this course are :