{"id":3848,"date":"2014-05-21T13:22:05","date_gmt":"2014-05-21T17:22:05","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=3848"},"modified":"2014-05-21T13:22:05","modified_gmt":"2014-05-21T17:22:05","slug":"creating-a-dsc-configuration-template","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell-4-0\/3848\/creating-a-dsc-configuration-template\/","title":{"rendered":"Creating a DSC Configuration Template"},"content":{"rendered":"<p>During the recent TechEd in Houston, there was a lot of talk and excitement about Desired State Configuration, or DSC. I'm not going to cover DSC itself here but rather address a minor issue for those of you just getting started. When you build a configuration, how can your figure out what resource settings to use?<\/p>\n<p>To start with, you can look use the Get-DSCResource cmdlet which will list all resources in the default locations.<\/p>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/05\/get-dscresource.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/05\/get-dscresource-1024x411.png\" alt=\"get-dscresource\" width=\"474\" height=\"190\" class=\"aligncenter size-large wp-image-3849\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/05\/get-dscresource-1024x411.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/05\/get-dscresource-300x120.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/05\/get-dscresource.png 1137w\" sizes=\"auto, (max-width: 474px) 100vw, 474px\" \/><\/a><\/p>\n<p>The properties for each resource are also there, although you have to dig a little.<\/p>\n<pre class=\"lang:ps decode:true \" >get-dscresource registry | Select -expand properties<\/pre>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/05\/get-dscresourceproperties.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/05\/get-dscresourceproperties-1024x411.png\" alt=\"get-dscresourceproperties\" width=\"474\" height=\"190\" class=\"aligncenter size-large wp-image-3850\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/05\/get-dscresourceproperties-1024x411.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/05\/get-dscresourceproperties-300x120.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/05\/get-dscresourceproperties.png 1137w\" sizes=\"auto, (max-width: 474px) 100vw, 474px\" \/><\/a><\/p>\n<p>From the screen shot you can see which properties are mandatory and the possible values for the rest. The Get-DSCResource cmdlet will even take this a step further and show you the complete syntax on how to use a particular resource.<\/p>\n<pre class=\"lang:ps decode:true \" >get-dscresource registry -Syntax<\/pre>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/05\/get-dscresourcesyntax.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/05\/get-dscresourcesyntax-1024x362.png\" alt=\"get-dscresourcesyntax\" width=\"474\" height=\"167\" class=\"aligncenter size-large wp-image-3851\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/05\/get-dscresourcesyntax-1024x362.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/05\/get-dscresourcesyntax-300x106.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/05\/get-dscresourcesyntax.png 1137w\" sizes=\"auto, (max-width: 474px) 100vw, 474px\" \/><\/a><\/p>\n<p>To build a configuration, you can copy, paste and edit. But I wanted more, as I often do when it comes to things PowerShell. So I wrote a function called New-DSCConfigurationTemplate that will generate a complete configuration with as many resources as you have available.<\/p>\n<pre class=\"lang:ps decode:true \" >#requires -version 4.0\r\n#requires -module PSDesiredStateConfiguration\r\n\r\nFunction New-DSCConfigurationTemplate {\r\n\r\n&lt;#\r\n.SYNOPSIS\r\nCreate a DSC configuration template\r\n.DESCRIPTION\r\nThis command will create a DSC configuration template using any of the available DSC resources on the local computer. By default, it will create a configuration for all resources. The template will show all possible values for each set of resource properties. Mandatory property names are prefaced with a * , which you must delete.\r\n\r\nIf you don't specify a file path or to use the ISE, then the configuration will be written to the pipeline.\r\n.PARAMETER Name\r\nThe name of the DSC resource\r\n.PARAMETER UseISE\r\nOpen the template in the PowerShell ISE. You must be running this command in ISE or specify a path.\r\n.PARAMETER Path\r\nSave the file to the specified path. You can also opt to open the file in the ISE after creating it.\r\n.EXAMPLE\r\nPS C:\\&gt; New-DSCConfigurationTemplate File,Service,Registry -path d:\\configs\\template1.ps1 -useIse\r\n\r\nCreate a DSC configuration template for resources File, Service and Registry. The example code will save it to a file and then open the file in the PowerShell ISE.\r\n.EXAMPLE\r\nPS C:\\&gt; New-DSCConfigurationTemplate -useISE\r\n\r\nAssuming this command is run in the ISE, it will create a configuration template using all DSC resources on the local computer and open it in the ISE as an untitled and unsaved file.\r\n.LINK\r\nGet-DSSResource\r\n.LINK\r\nhttp:\/\/jdhitsolutions.com\/blog\/2014\/05\/creating-a-dsc-configuration-template\r\n.NOTES\r\nLast Updated: May 17, 2014\r\nVersion     : 0.9\r\nAuthor      : @JeffHicks\r\n\r\nLearn more:\r\n PowerShell in Depth: An Administrator's Guide (http:\/\/www.manning.com\/jones2\/)\r\n PowerShell Deep Dives (http:\/\/manning.com\/hicks\/)\r\n Learn PowerShell in a Month of Lunches (http:\/\/manning.com\/jones3\/)\r\n Learn PowerShell Toolmaking in a Month of Lunches (http:\/\/manning.com\/jones4\/)\r\n \r\n\"Those who forget to script are doomed to repeat their work.\"\r\n\r\n  ****************************************************************\r\n  * DO NOT USE IN A PRODUCTION ENVIRONMENT UNTIL YOU HAVE TESTED *\r\n  * THOROUGHLY IN A LAB ENVIRONMENT. USE AT YOUR OWN RISK.  IF   *\r\n  * YOU DO NOT UNDERSTAND WHAT THIS SCRIPT DOES OR HOW IT WORKS, *\r\n  * DO NOT USE IT OUTSIDE OF A SECURE, TEST SETTING.             *\r\n  ****************************************************************\r\n#&gt;\r\n\r\n[cmdletbinding()]\r\nParam(\r\n[parameter(Position=0,ValueFromPipeline=$True)]\r\n[ValidateNotNullorEmpty()]\r\n[string[]]$Name=\"*\",\r\n[switch]$UseISE,\r\n[string]$Path\r\n)\r\n\r\nBegin {\r\n    Write-Verbose -Message \"Starting $($MyInvocation.Mycommand)\"  \r\n    $template=@\"\r\n#requires -version 4.0\r\n\r\nConfiguration MyDSCTemplate {\r\n\r\n#Settings with a * are mandatory. Delete the *.\r\n#edit and delete resource properties as necessary\r\n\r\nNode COMPUTERNAME {\r\n\r\n\"@\r\n\r\n} #begin\r\n\r\nProcess {\r\n\r\n\r\nforeach ($item in $name) {\r\nWrite-Verbose \"Getting resource $item \"\r\n$resources = Get-DscResource -Name $item\r\n\r\n    foreach ($resource in $resources) {\r\n[string[]]$entry = \"`n$($resource.name) &lt;ResourceID&gt; {`n\"\r\n\r\n    Write-Verbose \"Creating resource entry for $($resource.name)\"\r\n    $entry+=  foreach ($item in $resource.Properties) {\r\n     if ($item.IsMandatory) {\r\n       $name=\"*$($item.name)\"\r\n     }\r\n     else {\r\n     $name = $item.name\r\n     }\r\n\r\n     if ($item.PropertyType -eq '[bool]') {\r\n       $possibleValues = \"`$True | `$False\"\r\n     }\r\n    elseif ($item.values) {\r\n      $possibleValues = \"'$($item.Values -join \"' | '\")'\"\r\n     }\r\n    else {\r\n      $possibleValues=$item.PropertyType\r\n    } \r\n    \"$name = $($possibleValues)`n\"\r\n\r\n    } #foreach\r\n $entry+=\"} #end $($resource.name) resource`n`n\"\r\n #add the resource listing to the template\r\n $template+=$entry\r\n}\r\n} #foreach item in $name\r\n\r\n} #process\r\n\r\nEnd {\r\n\r\nWrite-Verbose \"closing template\"\r\n$template+=@\"\r\n } #close node\r\n\r\n} #close configuration\r\n\r\n\"@\r\n\r\nif ($path) {\r\nWrite-Verbose \"Saving template to $path\"\r\n  Try {\r\n    $template | Out-File -FilePath $path -ErrorAction Stop\r\n    if ($UseISE) {\r\n        Write-Verbose \"Opening $path in the ISE\"\r\n        ise $path\r\n    }\r\n  }\r\n  Catch {\r\n    Throw $_\r\n  }\r\n}\r\nelseif ($UseISE -And ($host.name -match \"PowerShell ISE\")) {\r\n    Write-Verbose \"Creating a new ISE PowerShell tab\"\r\n    $new = $psise.CurrentPowerShellTab.Files.Add()\r\n    Write-Verbose \"Inserting template into a new tab\"\r\n    $new.Editor.InsertText($template)\r\n}\r\nelseif ($UseISE -And ($host.name -notmatch \"PowerShell ISE\")) {    \r\n        Write-Warning \"Could not open template in the ISE. Are you in it? Otherwise, specify a path or run this in the ISE.\"\r\n  }\r\nelse {\r\n    Write-Verbose \"Writing template to the pipeline\"\r\n    $template\r\n}\r\n\r\n    #All finished\r\n    Write-Verbose -Message \"Ending $($MyInvocation.Mycommand)\"\r\n} #end\r\n\r\n} #end function\r\n<\/pre>\n<p>The function will create a configuration template with whatever resources you specify.<br \/>\n<a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/05\/new-dscconfig01.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/05\/new-dscconfig01-300x181.png\" alt=\"new-dscconfig01\" width=\"300\" height=\"181\" class=\"aligncenter size-medium wp-image-3853\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/05\/new-dscconfig01-300x181.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/05\/new-dscconfig01.png 874w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\nBy default the function writes to the pipeline, but you can specify a file name and even open the file in the ISE. Here's how to create a single template for all DSC resources on your computer.<\/p>\n<pre class=\"lang:ps decode:true \" >New-DSCConfigurationTemplate -Path c:\\scripts\\DSCConfigTemplate.ps1 -UseISE<\/pre>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/05\/new-dscconfig02.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/05\/new-dscconfig02-300x270.png\" alt=\"new-dscconfig02\" width=\"300\" height=\"270\" class=\"aligncenter size-medium wp-image-3854\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/05\/new-dscconfig02-300x270.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/05\/new-dscconfig02.png 860w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\nMandatory properties are preceded by a *, which you need to delete. Properties have all of the possible values or at the very least what type of value you need to enter. Simply delete what you don't want and in no time you have a complete DSC configuration! Don't forget to substitute a name in for <ResourceID> without the <>.<\/p>\n<p>I wrote this with the assumption that I could run this once to create a template, then copy and paste what I need into a new configuration. Another option would be to create ISE snippets for these resources.<\/p>\n<p>Personally, anything that saves me typing is a great help. I hope you'll let me know what you think.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>During the recent TechEd in Houston, there was a lot of talk and excitement about Desired State Configuration, or DSC. I&#8217;m not going to cover DSC itself here but rather address a minor issue for those of you just getting started. When you build a configuration, how can your figure out what resource settings to&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"Creating a #PowerShell DSC Configuration Template http:\/\/wp.me\/p1nF6U-104","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[450],"tags":[436,534],"class_list":["post-3848","post","type-post","status-publish","format-standard","hentry","category-powershell-4-0","tag-dsc","tag-powershell"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Creating a DSC Configuration Template &#8226; The Lonely Administrator<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jdhitsolutions.com\/blog\/powershell-4-0\/3848\/creating-a-dsc-configuration-template\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Creating a DSC Configuration Template &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"During the recent TechEd in Houston, there was a lot of talk and excitement about Desired State Configuration, or DSC. I&#039;m not going to cover DSC itself here but rather address a minor issue for those of you just getting started. When you build a configuration, how can your figure out what resource settings to...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell-4-0\/3848\/creating-a-dsc-configuration-template\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2014-05-21T17:22:05+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/05\/get-dscresource-1024x411.png\" \/>\n<meta name=\"author\" content=\"Jeffery Hicks\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:site\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeffery Hicks\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell-4-0\\\/3848\\\/creating-a-dsc-configuration-template\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell-4-0\\\/3848\\\/creating-a-dsc-configuration-template\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Creating a DSC Configuration Template\",\"datePublished\":\"2014-05-21T17:22:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell-4-0\\\/3848\\\/creating-a-dsc-configuration-template\\\/\"},\"wordCount\":349,\"commentCount\":3,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell-4-0\\\/3848\\\/creating-a-dsc-configuration-template\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2014\\\/05\\\/get-dscresource-1024x411.png\",\"keywords\":[\"DSC\",\"PowerShell\"],\"articleSection\":[\"PowerShell 4.0\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell-4-0\\\/3848\\\/creating-a-dsc-configuration-template\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell-4-0\\\/3848\\\/creating-a-dsc-configuration-template\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell-4-0\\\/3848\\\/creating-a-dsc-configuration-template\\\/\",\"name\":\"Creating a DSC Configuration Template &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell-4-0\\\/3848\\\/creating-a-dsc-configuration-template\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell-4-0\\\/3848\\\/creating-a-dsc-configuration-template\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2014\\\/05\\\/get-dscresource-1024x411.png\",\"datePublished\":\"2014-05-21T17:22:05+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell-4-0\\\/3848\\\/creating-a-dsc-configuration-template\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell-4-0\\\/3848\\\/creating-a-dsc-configuration-template\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell-4-0\\\/3848\\\/creating-a-dsc-configuration-template\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2014\\\/05\\\/get-dscresource.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2014\\\/05\\\/get-dscresource.png\",\"width\":1137,\"height\":457},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell-4-0\\\/3848\\\/creating-a-dsc-configuration-template\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell 4.0\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell-4-0\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Creating a DSC Configuration Template\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/\",\"name\":\"The Lonely Administrator\",\"description\":\"Practical Advice for the Automating IT Pro\",\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\",\"name\":\"Jeffery Hicks\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"caption\":\"Jeffery Hicks\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Creating a DSC Configuration Template &#8226; The Lonely Administrator","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jdhitsolutions.com\/blog\/powershell-4-0\/3848\/creating-a-dsc-configuration-template\/","og_locale":"en_US","og_type":"article","og_title":"Creating a DSC Configuration Template &#8226; The Lonely Administrator","og_description":"During the recent TechEd in Houston, there was a lot of talk and excitement about Desired State Configuration, or DSC. I'm not going to cover DSC itself here but rather address a minor issue for those of you just getting started. When you build a configuration, how can your figure out what resource settings to...","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell-4-0\/3848\/creating-a-dsc-configuration-template\/","og_site_name":"The Lonely Administrator","article_published_time":"2014-05-21T17:22:05+00:00","og_image":[{"url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/05\/get-dscresource-1024x411.png","type":"","width":"","height":""}],"author":"Jeffery Hicks","twitter_card":"summary_large_image","twitter_creator":"@JeffHicks","twitter_site":"@JeffHicks","twitter_misc":{"Written by":"Jeffery Hicks","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell-4-0\/3848\/creating-a-dsc-configuration-template\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell-4-0\/3848\/creating-a-dsc-configuration-template\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Creating a DSC Configuration Template","datePublished":"2014-05-21T17:22:05+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell-4-0\/3848\/creating-a-dsc-configuration-template\/"},"wordCount":349,"commentCount":3,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell-4-0\/3848\/creating-a-dsc-configuration-template\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/05\/get-dscresource-1024x411.png","keywords":["DSC","PowerShell"],"articleSection":["PowerShell 4.0"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell-4-0\/3848\/creating-a-dsc-configuration-template\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell-4-0\/3848\/creating-a-dsc-configuration-template\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell-4-0\/3848\/creating-a-dsc-configuration-template\/","name":"Creating a DSC Configuration Template &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell-4-0\/3848\/creating-a-dsc-configuration-template\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell-4-0\/3848\/creating-a-dsc-configuration-template\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/05\/get-dscresource-1024x411.png","datePublished":"2014-05-21T17:22:05+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell-4-0\/3848\/creating-a-dsc-configuration-template\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell-4-0\/3848\/creating-a-dsc-configuration-template\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell-4-0\/3848\/creating-a-dsc-configuration-template\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/05\/get-dscresource.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/05\/get-dscresource.png","width":1137,"height":457},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell-4-0\/3848\/creating-a-dsc-configuration-template\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell 4.0","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-4-0\/"},{"@type":"ListItem","position":2,"name":"Creating a DSC Configuration Template"}]},{"@type":"WebSite","@id":"https:\/\/jdhitsolutions.com\/blog\/#website","url":"https:\/\/jdhitsolutions.com\/blog\/","name":"The Lonely Administrator","description":"Practical Advice for the Automating IT Pro","publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jdhitsolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9","name":"Jeffery Hicks","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","url":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","caption":"Jeffery Hicks"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg"}}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":3857,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3857\/dsc-resource-snippets\/","url_meta":{"origin":3848,"position":0},"title":"DSC Resource Snippets","author":"Jeffery Hicks","date":"May 23, 2014","format":false,"excerpt":"A few days ago I posted a PowerShell script that would generate a DSC configuration template. The idea was to generate all the code you might need and let you whittle it down to just what you need. On my primary system, I don't have any community or experimental DSC\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"talkbubble","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/10\/talkbubble.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":3796,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3796\/configure-local-user-account-with-dsc\/","url_meta":{"origin":3848,"position":1},"title":"Configure Local User Account with DSC","author":"Jeffery Hicks","date":"April 16, 2014","format":false,"excerpt":"Yesterday I posted an article on how to use PowerShell and the [ADSI] type accelerator to set a local user account. However, if you are running PowerShell 4.0 you have another option: Desired State Configuration (DSC). I'm going to assume you have some basic understanding of how DSC works. If\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"talkbubble","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/10\/talkbubble.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":3861,"url":"https:\/\/jdhitsolutions.com\/blog\/training\/3861\/new-powershell-pluralsight-course\/","url_meta":{"origin":3848,"position":2},"title":"New PowerShell Pluralsight Course","author":"Jeffery Hicks","date":"May 23, 2014","format":false,"excerpt":"I am so happy to announce that my first course under the Pluralsight badge has been released. My latest course is titled PowerShell v4 New Features. This course is aimed at IT Pros with previous experience using PowerShell, especially PowerShell v3. The course runs just under 3 hours (although it\u2026","rel":"","context":"In &quot;Pluralsight&quot;","block_context":{"text":"Pluralsight","link":"https:\/\/jdhitsolutions.com\/blog\/category\/pluralsight\/"},"img":{"alt_text":"WatermarkLogo151x79","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/05\/WatermarkLogo151x79.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":4693,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4693\/computer-certificate-tools\/","url_meta":{"origin":3848,"position":3},"title":"Computer Certificate tools","author":"Jeffery Hicks","date":"December 21, 2015","format":false,"excerpt":"In my Pluralsight course on Advanced DSC I used a few functions I wrote to make it easier to work with computer certificates. If you need to encrypt things like passwords in a DSC configuration,\u00a0 you must some type of certificate thumbprint as well as a copy of the certificate.\u2026","rel":"","context":"In &quot;DSC&quot;","block_context":{"text":"DSC","link":"https:\/\/jdhitsolutions.com\/blog\/category\/dsc\/"},"img":{"alt_text":"Exporting a certificate","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2015\/12\/image_thumb-4.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2015\/12\/image_thumb-4.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2015\/12\/image_thumb-4.png?resize=525%2C300 1.5x"},"classes":[]},{"id":4348,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4348\/practicing-powershell-in-helsinki\/","url_meta":{"origin":3848,"position":4},"title":"Practicing PowerShell in Helsinki","author":"Jeffery Hicks","date":"April 8, 2015","format":false,"excerpt":"I am very happy to announce that in addition to my appearance at the MVP-AllStars conference on 9 June 2015 in beautiful Helsinki, Finland but that I will be following it with a 2 day, intense PowerShell workshop aimed at J\u00e4rjestelm\u00e4nvalvojat (system administrators or IT Pros). I think this is\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"helsinki","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2015\/04\/helsinki.jpg?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":3425,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3425\/powershell-4-0-a-first-look\/","url_meta":{"origin":3848,"position":5},"title":"PowerShell 4.0 A First Look","author":"Jeffery Hicks","date":"September 12, 2013","format":false,"excerpt":"My first look at PowerShell 4.0 is now online at 4Sysops.com. A few interesting bits but with 3.0 still gaining traction I'm wondering how much people will actually adopt 4.0. It seems to me that some of the biggest features like Desired State Configuration will require Windows Server 2012 on\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"021913_2047_WordTest1.png","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/02\/021913_2047_WordTest1.png?resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/3848","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=3848"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/3848\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=3848"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=3848"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=3848"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}