{"id":20703,"date":"2025-03-12T09:59:51","date_gmt":"2025-03-12T17:59:51","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/powershell\/?p=20703"},"modified":"2025-03-21T08:53:56","modified_gmt":"2025-03-21T16:53:56","slug":"get-started-with-dsc-v3","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/get-started-with-dsc-v3\/","title":{"rendered":"Get started with Microsoft Desired State Configuration v3.0.0"},"content":{"rendered":"<p><!-- markdownlint-disable MD041 --><\/p>\n<p><em>This is the second post in a multi-part series about the new release of DSC.<\/em><\/p>\n<p><strong>Microsoft Desired State Configuration (DSC) v3.0.0<\/strong> is a modern, cross-platform configuration\nmanagement framework designed to help administrators and developers declaratively define and enforce\nsystem states. Whether you&#8217;re managing infrastructure, deploying applications, or automating system\nconfigurations, DSC provides a flexible and scalable approach to configuration as code.<\/p>\n<p><div class=\"alert alert-success\"><p class=\"alert-divider\"><i class=\"fabric-icon fabric-icon--Lightbulb\"><\/i><strong>TIP<\/strong><\/p><\/p>\n<p>This post uses the following terminology:<\/p>\n<ul>\n<li><b>DSC<\/b> refers to Desired State Configuration (DSC) v3.0.0.<\/li>\n<li><b>PSDSC<\/b> refers to PowerShell Desired State Configuration (PSDSC) v1.1 and v2.<\/li>\n<\/ul>\n<p><\/div><\/p>\n<h2>Installing DSC<\/h2>\n<p>To get started, follow these steps to install DSC on your system:<\/p>\n<p>On Windows, you can install DSC from the Microsoft Store using <code>winget<\/code>. By installing from the\nStore or using <code>winget<\/code>, you get automatic updates for DSC.<\/p>\n<pre><code class=\"language-powershell\">winget search DesiredStateConfiguration\r\nwinget install --id &lt;insert-package-id&gt; --source msstore<\/code><\/pre>\n<p>On Linux and macOS, you can install DSC using the following steps:<\/p>\n<ol>\n<li>Download the latest release from the <a href=\"https:\/\/github.com\/PowerShell\/DSC\/releases\">PowerShell\/DSC<\/a> repository.<\/li>\n<li>Expand the release archive.<\/li>\n<li>Add the folder containing the expanded archive contents to your <code>PATH<\/code> environment variable.<\/li>\n<\/ol>\n<h2>Getting started with the DSC command<\/h2>\n<p>The <code>dsc<\/code> command operates on a configuration document or invokes specific resources to manage\nsettings.<\/p>\n<p>Run the following command to display the <code>dsc<\/code> command help:<\/p>\n<pre><code class=\"language-powershell\">dsc --help<\/code><\/pre>\n<pre><code class=\"language-Output\">Apply configuration or invoke specific DSC resources\r\n\r\nUsage: dsc.exe [OPTIONS] &lt;COMMAND&gt;\r\n\r\nCommands:\r\n  completer  Generate a shell completion script\r\n  config     Apply a configuration document\r\n  resource   Invoke a specific DSC resource\r\n  schema     Get the JSON schema for a DSC type\r\n  help       Print this message or the help of the given subcommand(s)\r\n\r\nOptions:\r\n  -l, --trace-level &lt;TRACE_LEVEL&gt;    Trace level to use [possible values: error, warn, info, debug, trace]\r\n  -t, --trace-format &lt;TRACE_FORMAT&gt;  Trace format to use [default: default] [possible values: default, plaintext, json]\r\n  -h, --help                         Print help\r\n  -V, --version                      Print version<\/code><\/pre>\n<p>Use the command to get version information.<\/p>\n<pre><code class=\"language-powershell\">dsc --version<\/code><\/pre>\n<pre><code class=\"language-Output\">dsc 3.0.0<\/code><\/pre>\n<p>To learn more, see <a href=\"https:\/\/learn.microsoft.com\/powershell\/dsc\/reference\/cli\/dsc?view=dsc-3.0&amp;preserveView=true\">the <code>dsc<\/code> command reference documentation<\/a>.<\/p>\n<h3>Access DSC resources with <code>dsc resource<\/code><\/h3>\n<p>The <code>dsc resource<\/code> command displays or invokes a specific DSC resource. The <code>dsc resource<\/code> command\ncontains subcommands for listing DSC resources and invoking them directly.<\/p>\n<p>Use the following command to display a list of installed DSC resources.<\/p>\n<pre><code class=\"language-powershell\">dsc resource list<\/code><\/pre>\n<pre><code class=\"language-Output\">Type                                        Kind      Version  Caps      RequireAdapter  Description\r\n----------------------------------------------------------------------------------------------------\r\nMicrosoft.DSC.Transitional\/RunCommandOnSet  Resource  0.1.0    gs------                  Takes a si\u2026\r\nMicrosoft.DSC\/Assertion                     Group     0.1.0    gs--t---                  `test` wil\u2026\r\nMicrosoft.DSC\/Group                         Group     0.1.0    gs--t---                  All resour\u2026\r\nMicrosoft.DSC\/PowerShell                    Adapter   0.1.0    gs--t-e-                  Resource a\u2026\r\nMicrosoft.Windows\/RebootPending             Resource  0.1.0    g-------                  Returns in\u2026\r\nMicrosoft.Windows\/Registry                  Resource  0.1.0    gs-w-d--                  Manage Win\u2026\r\nMicrosoft.Windows\/WMI                       Adapter   0.1.0    g-------                  Resource a\u2026\r\nMicrosoft.Windows\/WindowsPowerShell         Adapter   0.1.0    gs--t---                  Resource a\u2026<\/code><\/pre>\n<p>When the command includes the adapter option, <code>dsc<\/code> checks for any resource adapters with a matching\nname. Classic PowerShell resources are part of the <code>Microsoft.Windows\/WindowsPowerShell<\/code> adapter.<\/p>\n<pre><code class=\"language-powershell\">dsc resource list --adapter Microsoft.Windows\/WindowsPowerShell<\/code><\/pre>\n<pre><code class=\"language-Output\">Partial listing\r\n\r\nType                                                   Kind      Version  Caps      RequireAdapter\r\n----------------------------------------------------------------------------------------------------\r\nPSDesiredStateConfiguration\/Archive                    Resource  1.1      gs--t---  Microsoft.Windo\u2026\r\nPSDesiredStateConfiguration\/Environment                Resource  1.1      gs--t---  Microsoft.Windo\u2026\r\nPSDesiredStateConfiguration\/File                       Resource  1.0.0    gs--t---  Microsoft.Windo\u2026\r\nPSDesiredStateConfiguration\/Group                      Resource  1.1      gs--t---  Microsoft.Windo\u2026\r\nPSDesiredStateConfiguration\/GroupSet                   Resource  1.1      gs--t---  Microsoft.Windo\u2026\r\nPSDesiredStateConfiguration\/Log                        Resource  1.1      gs--t---  Microsoft.Windo\u2026<\/code><\/pre>\n<p>To learn more, see <a href=\"https:\/\/learn.microsoft.com\/powershell\/dsc\/reference\/cli\/resource\/command?view=dsc-3.0&amp;preserveView=true\">the <code>dsc<\/code> resource command reference documentation<\/a>.<\/p>\n<h3>Manage a basic configuration<\/h3>\n<p>The <code>dsc config<\/code> command includes subcommands for managing the resource instances defined in a DSC\nconfiguration document.<\/p>\n<p>The following YAML configuration document calls the classic PowerShell resource <code>WindowsFeature<\/code>\nfrom the <strong>PSDesiredStateConfiguration<\/strong> module to install a Windows web server (IIS) on Windows\nServer.<\/p>\n<pre><code class=\"language-yml\">$schema: https:\/\/raw.githubusercontent.com\/PowerShell\/DSC\/main\/schemas\/2024\/04\/config\/document.json\r\nresources:\r\n  - name: Use Windows PowerShell resources\r\n    type: Microsoft.Windows\/WindowsPowerShell\r\n    properties:\r\n      resources:\r\n        - name: Web server install\r\n          type: PSDesiredStateConfiguration\/WindowsFeature\r\n          properties:\r\n            Name: Web-Server\r\n            Ensure: Present<\/code><\/pre>\n<p>To set a machine to the configuration, use the <code>dsc config set<\/code> subcommand. The following example\nshows how you can send the configuration document to DSCv3 using PowerShell:<\/p>\n<pre><code class=\"language-powershell\">dsc config get --file .\/web.comfig.dsc.yaml<\/code><\/pre>\n<p>To learn more, see <a href=\"https:\/\/learn.microsoft.com\/powershell\/dsc\/reference\/cli\/config\/command?view=dsc-3.0&amp;preserveView=true\">the <code>dsc config<\/code> command reference documentation<\/a>.<\/p>\n<h2>Next steps<\/h2>\n<p>Learn more about <a href=\"https:\/\/devblogs.microsoft.com\/powershell\/enhanced-authoring-with-dsc-v3\/\">Authoring <\/a><a href=\"https:\/\/devblogs.microsoft.com\/powershell\/enhanced-authoring-with-dsc-v3\/\">Enhancements in <\/a><a href=\"https:\/\/devblogs.microsoft.com\/powershell\/enhanced-authoring-with-dsc-v3\/\">Desired State Configuration v3.0.0<\/a>.<\/p>\n<h2>Call to action<\/h2>\n<p>For more information about DSC v3.0, see the <a href=\"https:\/\/learn.microsoft.com\/powershell\/dsc\/overview?view=dsc-3.0&amp;preserveView=true\">DSCv3 documentation<\/a>. We value your feedback. Stop\nby our <a href=\"https:\/\/github.com\/PowerShell\/DSC\">GitHub repository<\/a> and let us know of any issues you find.<\/p>\n<p>Jason Helmick<\/p>\n<p>Sr. Product Manager, PowerShell<\/p>\n<p><!-- link references --><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post show you how to install DSC v3.0.0 and get started using the **dsc** command.<\/p>\n","protected":false},"author":7527,"featured_media":13641,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[3197],"class_list":["post-20703","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell","tag-powershell-dsc"],"acf":[],"blog_post_summary":"<p>This post show you how to install DSC v3.0.0 and get started using the **dsc** command.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/20703","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/users\/7527"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/comments?post=20703"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/20703\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media\/13641"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media?parent=20703"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=20703"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=20703"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}