{"id":1971,"date":"2013-11-19T14:56:00","date_gmt":"2013-11-19T14:56:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/powershell\/2013\/11\/19\/resource-designer-tool-a-walkthrough-writing-a-dsc-resource\/"},"modified":"2022-11-09T09:46:39","modified_gmt":"2022-11-09T17:46:39","slug":"resource-designer-tool-a-walkthrough-writing-a-dsc-resource","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/resource-designer-tool-a-walkthrough-writing-a-dsc-resource\/","title":{"rendered":"Resource Designer Tool \u2013 A walkthrough writing a DSC resource"},"content":{"rendered":"<p class=\"MsoNormal\">At the heart of Windows PowerShell Desired State Configuration are the resources. It is the resources which act behind the scenes for DSC to achieve its \u201cmake it so\u201d philosophy. DSC ships with a number of resources in-box and you can take a look <a href=\"http:\/\/technet.microsoft.com\/en-us\/library\/dn249921.aspx\">here<\/a> for the complete list. However, once you get started with DSC, you may want to write your own resources (which are PowerShell modules) for your particular use case. This post will walk you through creating a custom DSC resource. You can take a look <a href=\"https:\/\/devblogs.microsoft.com\/powershell\/hungry-for-more-windows-powershell-desired-state-configuration-resources\/\">here<\/a> to get an understanding of the schema\/packaging of DSC resources. Attached with this post is the Resource Designer Tool which makes writing resources a breeze.<\/p>\n<p class=\"MsoNormal\">There are certain rules which must be complied with when writing a DSC resource. I will state the rules towards the end of the post for reference and completeness. The Resource Designer Tool takes care of the nitty-gritty so that you can concentrate on implementing the features in your resource without having to get caught up in figuring out the correct MOF syntax or worrying about missing some important requirements in the resources (which is a PowerShell module) file.<\/p>\n<p class=\"MsoNormal\">Let us take an example. Say you want to create a resource for modelling an Active Directory User. (The User resource shipped in-box is for local users only.) In this example, we will have the following configuration properties in our schema MOF:<\/p>\n<div class=\"WordSection1\">\n<ul>\n<li><span style=\"font-family: ca; font-size: x-small;\">UserName -&gt; This will be the key property for our resource to uniquely identify a user. This is a required property<\/span><\/li>\n<li><span style=\"font-family: ca; font-size: x-small;\">Ensure -&gt; This can only take two values: \u2018Present\u2019 and \u2018Absent\u2019 for stating whether we want the user account to be present or absent.<\/span><\/li>\n<li><span style=\"font-family: ca; font-size: x-small;\">DomainAdminCredential -&gt; This will hold the domain account password for the user.<\/span><\/li>\n<li><span style=\"font-family: ca; font-size: x-small;\">Password -&gt; This will hold the new password in case we wish to change an existing password.<\/span><\/li>\n<\/ul>\n<\/div>\n<p class=\"MsoNormal\">Once we have the properties all set out, we can begin using the Resource Designer Tool. For this, create a folder named \u2018<span class=\"SpellE\">DSCPack_ResourceDesigner<\/span>\u2019 anywhere inside your $<span class=\"SpellE\">env<span class=\"GramE\">:PSModulePath<\/span><\/span>, download the attachments and place them inside the folder you just created. After this, import the module (using \u2018Import-Module <span class=\"SpellE\">xDSCResourceDesigner<\/span>\u2019). We are all set. Let\u2019s dive in now!<\/p>\n<p class=\"MsoNormal\">Let us see all the commands which we have as part of the designer tool:<\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">PS <span class=\"GramE\">C:<\/span>\\&gt; (Get-Module <span class=\"SpellE\">xDSCResourceDesigner<\/span>).<span class=\"SpellE\">ExportedCommands<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">Key\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Value<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">&#8212;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8212;&#8211;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">Import-x<span class=\"SpellE\">DscSchema<\/span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Import-x<span class=\"SpellE\">DscSchema<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">New-x<span class=\"SpellE\">DscResource<\/span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0New-x<span class=\"SpellE\">DscResource<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">New-x<span class=\"SpellE\">DscResourceProperty<\/span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0New-x<span class=\"SpellE\">DscResourceProperty<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">Test-x<span class=\"SpellE\">DscResource<\/span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Test-x<span class=\"SpellE\">DscResource<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">Test-x<span class=\"SpellE\">DscSchema<\/span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Test-x<span class=\"SpellE\">DscSchema<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">Update-x<span class=\"SpellE\">DscResource<\/span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Update-x<span class=\"SpellE\">DscResource<\/span><\/span><\/p>\n<p class=\"MsoNormal\">The first cmdlet we will be using is New-x<span class=\"SpellE\">DscResourceProperty<\/span>. Let us explore it.<\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">PS <span class=\"GramE\">C:<\/span>\\&gt; help New-x<span class=\"SpellE\">DscResourceProperty<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">NAME<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 New-x<span class=\"SpellE\">DscResourceProperty<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 <\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">SYNOPSIS<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 Creates a <span class=\"SpellE\">DscResourceProperty<\/span> to be used by New-x<span class=\"SpellE\">DscResource<\/span>.<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 <\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 <\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">SYNTAX<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 New-x<span class=\"SpellE\">DscResourceProperty<\/span> [-Name] &lt;String&gt; [-Type] &lt;String&gt; [-Attribute] {Key | Required | Read<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 | Write} [-<span class=\"SpellE\">ValidateSet<\/span> &lt;<span class=\"GramE\">String[<\/span>]&gt;] [-Description &lt;String&gt;] [&lt;<span class=\"SpellE\">CommonParameters<\/span>&gt;]<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 <\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 <\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">DESCRIPTION<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 Takes all of the given arguments and constructs a <span class=\"SpellE\">DscResourceProperty<\/span> object to be used by New-x<span class=\"SpellE\">DscResource<\/span>.<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 <\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">RELATED LINKS<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">REMARKS<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 To see the examples, type: &#8220;get-help New-x<span class=\"SpellE\">DscResourceProperty<\/span> -examples&#8221;.<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 For more information, type: &#8220;get-help New-x<span class=\"SpellE\">DscResourceProperty<\/span> -detailed&#8221;.<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 For technical information, type: &#8220;get-help New-x<span class=\"SpellE\">DscResourceProperty<\/span> -full&#8221;. <\/span><\/p>\n<p class=\"MsoNormal\">For every configuration property we want, we need to define it using this cmdlet. Let us see how we would define the various properties we stated earlier:<\/p>\n<p class=\"MsoNormal\"><span class=\"SpellE\"><strong>UserName<\/strong><\/span><strong>: <\/strong><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">PS <span class=\"GramE\">C:<\/span>\\&gt; $<span class=\"SpellE\">UserName<\/span> = New-x<span class=\"SpellE\">DscResourceProperty<\/span> -Name <span class=\"SpellE\">UserName<\/span> -Type String -Attribute Key <\/span><\/p>\n<p class=\"MsoNormal\"><strong>\u00a0<\/strong><\/p>\n<p class=\"MsoNormal\"><strong>Ensure:<\/strong><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">PS <span class=\"GramE\">C:<\/span>\\&gt; $Ensure = New-x<span class=\"SpellE\">DscResourceProperty<\/span> -Name Ensure -Type String -Attribute Write &#8211;<span class=\"SpellE\">ValidateSet<\/span> &#8220;Present&#8221;, &#8220;Absent&#8221;\u00a0 <\/span><\/p>\n<p class=\"MsoNormal\"><strong>\u00a0<\/strong><\/p>\n<p class=\"MsoNormal\"><span class=\"SpellE\"><strong>DomainCredential<\/strong><\/span><strong>:<\/strong><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">PS <span class=\"GramE\">C:<\/span>\\&gt; $<span class=\"SpellE\">DomainCredential<\/span> = New-x<span class=\"SpellE\">DscResourceProperty<\/span> -Name <span class=\"SpellE\">DomainAdminCredential<\/span> -Type <span class=\"SpellE\">PSCredential<\/span> -Attribute Write <\/span><\/p>\n<p class=\"MsoNormal\"><strong>\u00a0<\/strong><\/p>\n<p class=\"MsoNormal\"><strong>Password:<\/strong><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">PS <span class=\"GramE\">C:<\/span>\\&gt; $Password = New-x<span class=\"SpellE\">DscResourceProperty<\/span> -Name Password -Type <span class=\"SpellE\">PSCredential<\/span> -Attribute Write <\/span><\/p>\n<p class=\"MsoNormal\"><strong>\u00a0<\/strong><\/p>\n<p class=\"MsoNormal\">Now that the properties are defined, let us see how to generate the PowerShell module that will contain the implementation logic of the resource and the schema MOF file which will be consumed by DSC. The cmdlet we are looking for is New-x<span class=\"SpellE\">DscResource<\/span>.<\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">PS <span class=\"GramE\">C:<\/span>\\&gt; help New-x<span class=\"SpellE\">DscResource<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">NAME<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 New-x<span class=\"SpellE\">DscResource<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 <\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">SYNOPSIS<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 Creates a <span class=\"SpellE\">DscResource<\/span> based on the given arguments.<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 <\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 <\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">SYNTAX<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 New-x<span class=\"SpellE\">DscResource<\/span> [-Name] &lt;String&gt; [-Property] &lt;<span class=\"SpellE\"><span class=\"GramE\">DscResourceProperty<\/span><\/span><span class=\"GramE\">[<\/span>]&gt; [[-Path] &lt;String&gt;] <\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 [[-ModuleName] &lt;String&gt;] [-<span class=\"SpellE\">ClassVersion <\/span>&lt;Version&gt;] [-<span class=\"SpellE\">FriendlyName<\/span> <\/span><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">&lt;String&gt;] [-Force] <\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 [-<span class=\"SpellE\">WhatIf<\/span>] [-Confirm] <\/span><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">[&lt;<span class=\"SpellE\">CommonParameters<\/span>&gt;]<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 <\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 <\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">DESCRIPTION<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 Creates a .psd1, .psm1, and .<span class=\"SpellE\">schema.mof<\/span> file representing a <span class=\"SpellE\"><span class=\"GramE\">Dsc<\/span><\/span> Resource based on the properties and values passed in.<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 <\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">RELATED LINKS<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">REMARKS<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 To see the examples, type: &#8220;get-help New-x<span class=\"SpellE\">DscResource<\/span> -examples&#8221;.<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 For more information, type: &#8220;get-help New-x<span class=\"SpellE\">DscResource<\/span> -detailed&#8221;.<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 For technical information, type: &#8220;get-help New-x<span class=\"SpellE\">DscResource<\/span> -full&#8221;.<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\"><strong>\u00a0<\/strong><\/p>\n<p class=\"MsoNormal\">Let us use the properties which we just defined to create the DSC resource.<\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">PS <span class=\"GramE\">C:<\/span>\\&gt; New-x<span class=\"SpellE\">DscResource<\/span> -Name <span class=\"SpellE\">Demo_ADUser<\/span> -Property $<span class=\"SpellE\">UserName<\/span>, $Ensure, $<span class=\"SpellE\">DomainCredential<\/span>, $Password -Path &#8216;C:\\Program Files\\<span class=\"SpellE\">WindowsPowerShell<\/span>\\Modules&#8217; -ModuleName Demo_DSCModule\u00a0 <\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\">Here is the output we get:<\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 12pt;\">\u00a0<\/span><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0 Directory: C:\\Program Files\\<span class=\"SpellE\">WindowsPowerShell<\/span>\\Modules<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">Mode\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span class=\"SpellE\">LastWriteTime<\/span>\u00a0\u00a0\u00a0\u00a0 Length Name<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">&#8212;-\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8212;&#8212;&#8212;&#8212;-\u00a0\u00a0\u00a0\u00a0 &#8212;&#8212; &#8212;-<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">d&#8212;-\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 11\/13\/2013\u00a0\u00a0 3:42 PM\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Demo_DSCModule<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 <\/span>Directory: C:\\Program Files\\<span class=\"SpellE\">WindowsPowerShell<\/span>\\Modules\\<span class=\"SpellE\">Demo_DSCModule<\/span><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">Mode\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span class=\"SpellE\">LastWriteTime<\/span>\u00a0\u00a0\u00a0\u00a0 Length Name<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">&#8212;-\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8212;&#8212;&#8212;&#8212;-\u00a0\u00a0\u00a0\u00a0 &#8212;&#8212; &#8212;-<\/span><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">d&#8212;-\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 11\/13\/2013\u00a0\u00a0 3:42 PM\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 DSCResources<\/span><\/span><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 Directory: C:\\Program Files\\<span class=\"SpellE\">WindowsPowerShell<\/span>\\Modules\\<span class=\"SpellE\">Demo_DSCModule<\/span>\\<span class=\"SpellE\">DSCResources<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">Mode\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span class=\"SpellE\">LastWriteTime<\/span>\u00a0\u00a0\u00a0\u00a0 Length Name<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">&#8212;-\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8212;&#8212;&#8212;&#8212;-\u00a0\u00a0\u00a0\u00a0 &#8212;&#8212; &#8212;-<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">d&#8212;-\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 11\/13\/2013\u00a0\u00a0 3:42 PM\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span class=\"SpellE\">Demo_ADUser<\/span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\"><strong>\u00a0<\/strong><\/p>\n<p class=\"MsoNormal\">Looks like something exciting is going on here. A directory for our custom DSC resource has been created. Let us peek into what is in there.<\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">PS <span class=\"GramE\">C:<\/span>\\&gt; cd &#8216;C:\\Program Files\\WindowsPowerShell\\Modules\\Demo_DSCModule\\DSCResources\\Demo_ADUser&#8217;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">PS C:\\Program Files\\WindowsPowerShell\\Modules\\Demo_DSCModule\\DSCResources\\Demo_ADUser&gt; <span class=\"SpellE\">dir<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 Directory: C:\\Program Files\\WindowsPowerShell\\Modules\\Demo_DSCModule\\DSCResources\\Demo_ADUser<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">Mode\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span class=\"SpellE\">LastWriteTime<\/span>\u00a0\u00a0\u00a0\u00a0 Length Name<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">&#8212;-\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8212;&#8212;&#8212;&#8212;-\u00a0\u00a0\u00a0\u00a0 &#8212;&#8212; &#8212;-<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">-a&#8212;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 11\/13\/2013\u00a0\u00a0 3:42 PM\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 3770 Demo_ADUser.psm1<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">-a&#8212;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 11\/13\/2013\u00a0\u00a0 3:42 PM\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 700 <span class=\"SpellE\">Demo_ADUser.schema.mof<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\">Let us take a look at the contents of the schema MOF:<\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">[<span class=\"SpellE\"><span class=\"GramE\">ClassVersion<\/span><\/span><span class=\"GramE\">(<\/span>&#8220;1.0.0.0&#8221;), <span class=\"SpellE\">FriendlyName<\/span>(&#8220;<span class=\"SpellE\">Demo_ADUser<\/span>&#8220;)]<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span class=\"GramE\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">class<\/span><\/span><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\"> <span class=\"SpellE\">Demo_ADUser<\/span> : <span class=\"SpellE\">OMI_BaseResource<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">{<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 [Key] String <span class=\"SpellE\">UserName<\/span>;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 [Write, <span class=\"SpellE\"><span class=\"GramE\">ValueMap<\/span><\/span><span class=\"GramE\">{<\/span>&#8220;<span class=\"SpellE\">Present&#8221;,&#8221;Absent<\/span>&#8220;}, Values{&#8220;<span class=\"SpellE\">Present&#8221;,&#8221;Absent<\/span>&#8220;}] String Ensure;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 [Write, <span class=\"SpellE\"><span class=\"GramE\">EmbeddedInstance<\/span><\/span><span class=\"GramE\">(<\/span>&#8220;<span class=\"SpellE\">MSFT_Credential<\/span>&#8220;)] String <span class=\"SpellE\">DomainAdminCredential<\/span>;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 [Write, <span class=\"SpellE\"><span class=\"GramE\">EmbeddedInstance<\/span><\/span><span class=\"GramE\">(<\/span>&#8220;<span class=\"SpellE\">MSFT_Credential<\/span>&#8220;)] String Password;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">}; <\/span><\/p>\n<p class=\"MsoNormal\">The designer tool took care of the syntax of the MOF file for us. One of the nice things I liked about the tool when I first started using it was that it took care of deriving the class from \u2018<span class=\"SpellE\">OMI_BaseResource<\/span>\u2019. I would always forget about this. Also take note of how it converted \u2018<span class=\"SpellE\">ValidateSet<\/span>\u2019 \u2013 a term well known to PowerShell scripters into \u2018<span class=\"SpellE\">ValueMap<\/span>\u2019 \u2013 a term specific to CIM schema language specification. Similarly it knows to convert \u2018<span class=\"SpellE\">PSCredential<\/span>\u2019 into the type \u2018<span class=\"SpellE\">MSFT_Credential<\/span>\u2019 which is understood by the DSC Engine.<\/p>\n<p class=\"MsoNormal\">Next, let us see what the psm1 file looks like (As explained <a href=\"https:\/\/devblogs.microsoft.com\/powershell\/hungry-for-more-windows-powershell-desired-state-configuration-resources\/\">here<\/a>, this file contains the three \u2018*-Target-Resource\u2019 functions):<\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span class=\"GramE\"><span style=\"color: darkblue; font-family: 'Lucida Console'; font-size: 9pt;\">function<\/span><\/span><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\"> <span style=\"color: blueviolet;\">Get-<span class=\"SpellE\">TargetResource<\/span><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">{<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: darkgray;\">[<\/span><span class=\"SpellE\"><span class=\"GramE\"><span style=\"color: deepskyblue;\">CmdletBinding<\/span><\/span><\/span><span class=\"GramE\">(<\/span>)<span style=\"color: darkgray;\">]<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: darkgray;\">[<\/span><span class=\"SpellE\"><span class=\"GramE\"><span style=\"color: deepskyblue;\">OutputType<\/span><\/span><\/span><span class=\"GramE\">(<\/span><span style=\"color: darkgray;\">[<\/span><span class=\"SpellE\"><span style=\"color: teal;\">System.Collections.Hashtable<\/span><\/span><span style=\"color: darkgray;\">]<\/span>)<span style=\"color: darkgray;\">]<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span class=\"SpellE\"><span class=\"GramE\"><span style=\"color: darkblue;\">param<\/span><\/span><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: darkgray;\">[<\/span><span class=\"GramE\"><span style=\"color: deepskyblue;\">parameter<\/span>(<\/span>Mandatory <span style=\"color: darkgray;\">=<\/span> <span style=\"color: orangered;\">$true<\/span>)<span style=\"color: darkgray;\">]<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: darkgray;\">[<\/span><span class=\"SpellE\"><span style=\"color: teal;\">System.String<\/span><\/span><span style=\"color: darkgray;\">]<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: orangered;\">$<span class=\"SpellE\">UserName<\/span><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 )<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: darkgreen;\">#Write-Verbose &#8220;Use this cmdlet to deliver information about command processing.&#8221;<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: darkgreen;\">#Write-Debug &#8220;Use this cmdlet to write debug information while troubleshooting.&#8221;<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: darkgreen;\">&lt;#<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: darkgreen; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $<span class=\"SpellE\">returnValue<\/span> = <span class=\"GramE\">@{<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: darkgreen; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span class=\"SpellE\">UserName<\/span> = [<span class=\"SpellE\">System.String<\/span>]<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: darkgreen; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Ensure = [<span class=\"SpellE\">System.String<\/span>]<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: darkgreen; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span class=\"SpellE\">DomainAdminCredential<\/span> = [<span class=\"SpellE\">System.Management.Automation.PSCredential<\/span>]<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: darkgreen; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Password = [<span class=\"SpellE\">System.Management.Automation.PSCredential<\/span>]<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: darkgreen; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: darkgreen; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: darkgreen; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $<span class=\"SpellE\">returnValue<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: darkgreen; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 #&gt;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">}<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span class=\"GramE\"><span style=\"color: darkblue; font-family: 'Lucida Console'; font-size: 9pt;\">function<\/span><\/span><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\"> <span style=\"color: blueviolet;\">Set-<span class=\"SpellE\">TargetResource<\/span><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">{<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: darkgray;\">[<\/span><span class=\"SpellE\"><span class=\"GramE\"><span style=\"color: deepskyblue;\">CmdletBinding<\/span><\/span><\/span><span class=\"GramE\">(<\/span>)<span style=\"color: darkgray;\">]<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span class=\"SpellE\"><span class=\"GramE\"><span style=\"color: darkblue;\">param<\/span><\/span><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: darkgray;\">[<\/span><span class=\"GramE\"><span style=\"color: deepskyblue;\">parameter<\/span>(<\/span>Mandatory <span style=\"color: darkgray;\">=<\/span> <span style=\"color: orangered;\">$true<\/span>)<span style=\"color: darkgray;\">]<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: darkgray;\">[<\/span><span class=\"SpellE\"><span style=\"color: teal;\">System.String<\/span><\/span><span style=\"color: darkgray;\">]<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: orangered;\">$<span class=\"SpellE\">UserName<\/span><\/span><span style=\"color: darkgray;\">,<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: darkgray;\">[<\/span><span class=\"SpellE\"><span class=\"GramE\"><span style=\"color: deepskyblue;\">ValidateSet<\/span><\/span><\/span><span class=\"GramE\">(<\/span><span style=\"color: darkred;\">&#8220;<span class=\"SpellE\">Present&#8221;<span style=\"color: darkgray;\">,<\/span>&#8220;Absent<\/span>&#8220;<\/span>)<span style=\"color: darkgray;\">]<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: darkgray;\">[<\/span><span class=\"SpellE\"><span style=\"color: teal;\">System.String<\/span><\/span><span style=\"color: darkgray;\">]<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: orangered;\">$Ensure<\/span><span style=\"color: darkgray;\">,<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: darkgray;\">[<\/span><span class=\"SpellE\"><span style=\"color: teal;\">System.Management.Automation.PSCredential<\/span><\/span><span style=\"color: darkgray;\">]<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: orangered;\">$<span class=\"SpellE\">DomainAdminCredential<\/span><\/span><span style=\"color: darkgray;\">,<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: darkgray;\">[<\/span><span class=\"SpellE\"><span style=\"color: teal;\">System.Management.Automation.PSCredential<\/span><\/span><span style=\"color: darkgray;\">]<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: orangered;\">$Password<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 )<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: darkgreen;\">#Write-Verbose &#8220;Use this cmdlet to deliver information about command processing.&#8221;<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: darkgreen;\">#Write-Debug &#8220;Use this cmdlet to write debug information while troubleshooting.&#8221;<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: darkgreen;\">#Include this line if the resource requires a system reboot.<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: darkgreen;\">#$<span class=\"SpellE\">global<span class=\"GramE\">:DSCMachineStatus<\/span><\/span> = 1<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">}<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span class=\"GramE\"><span style=\"color: darkblue; font-family: 'Lucida Console'; font-size: 9pt;\">function<\/span><\/span><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\"> <span style=\"color: blueviolet;\">Test-<span class=\"SpellE\">TargetResource<\/span><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">{<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: darkgray;\">[<\/span><span class=\"SpellE\"><span class=\"GramE\"><span style=\"color: deepskyblue;\">CmdletBinding<\/span><\/span><\/span><span class=\"GramE\">(<\/span>)<span style=\"color: darkgray;\">]<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: darkgray;\">[<\/span><span class=\"SpellE\"><span class=\"GramE\"><span style=\"color: deepskyblue;\">OutputType<\/span><\/span><\/span><span class=\"GramE\">(<\/span><span style=\"color: darkgray;\">[<\/span><span class=\"SpellE\"><span style=\"color: teal;\">System.Boolean<\/span><\/span><span style=\"color: darkgray;\">]<\/span>)<span style=\"color: darkgray;\">]<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span class=\"SpellE\"><span class=\"GramE\"><span style=\"color: darkblue;\">param<\/span><\/span><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: darkgray;\">[<\/span><span class=\"GramE\"><span style=\"color: deepskyblue;\">parameter<\/span>(<\/span>Mandatory <span style=\"color: darkgray;\">=<\/span> <span style=\"color: orangered;\">$true<\/span>)<span style=\"color: darkgray;\">]<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: darkgray;\">[<\/span><span class=\"SpellE\"><span style=\"color: teal;\">System.String<\/span><\/span><span style=\"color: darkgray;\">]<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: orangered;\">$<span class=\"SpellE\">UserName<\/span><\/span><span style=\"color: darkgray;\">,<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: darkgray;\">[<\/span><span class=\"SpellE\"><span class=\"GramE\"><span style=\"color: deepskyblue;\">ValidateSet<\/span><\/span><\/span><span class=\"GramE\">(<\/span><span style=\"color: darkred;\">&#8220;<span class=\"SpellE\">Present&#8221;<span style=\"color: darkgray;\">,<\/span>&#8220;Absent<\/span>&#8220;<\/span>)<span style=\"color: darkgray;\">]<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: darkgray;\">[<\/span><span class=\"SpellE\"><span style=\"color: teal;\">System.String<\/span><\/span><span style=\"color: darkgray;\">]<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: orangered;\">$Ensure<\/span><span style=\"color: darkgray;\">,<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: darkgray;\">[<\/span><span class=\"SpellE\"><span style=\"color: teal;\">System.Management.Automation.PSCredential<\/span><\/span><span style=\"color: darkgray;\">]<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: orangered;\">$<span class=\"SpellE\">DomainAdminCredential<\/span><\/span><span style=\"color: darkgray;\">,<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: darkgray;\">[<\/span><span class=\"SpellE\"><span style=\"color: teal;\">System.Management.Automation.PSCredential<\/span><\/span><span style=\"color: darkgray;\">]<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: orangered;\">$Password<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 )<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: darkgreen;\">#Write-Verbose &#8220;Use this cmdlet to deliver information about command processing.&#8221;<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: darkgreen;\">#Write-Debug &#8220;Use this cmdlet to write debug information while troubleshooting.&#8221;<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: darkgreen;\">&lt;#<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: darkgreen; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $result = [<span class=\"SpellE\">System.Boolean<\/span>]<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: darkgreen; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: darkgreen; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $result<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: darkgreen; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 #&gt;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">}<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: blue; font-family: 'Lucida Console'; font-size: 9pt;\">Export-<span class=\"SpellE\">ModuleMember<\/span><\/span><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\"> <span style=\"color: navy;\">-Function<\/span> <span style=\"color: blueviolet;\">*-<span class=\"SpellE\">TargetResource<\/span><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\">This is the skeleton of the PowerShell Module generated by the tool. It contains the three functions that <strong>all <\/strong>DSC resources must define: <strong>Get-<span class=\"SpellE\">TargetResource<\/span>, Test-<span class=\"SpellE\">TargetResource<\/span> and Set-<span class=\"SpellE\">TargetResource<\/span><\/strong>. It also adds in some comments to help us with writing the resource. For example, take a look at the Test-<span class=\"SpellE\">TargetResource<\/span> function. Since DSC is idempotent, we can apply the same configuration multiple times and if the current state is the same as the desired state, no action is taken. This is achieved by the DSC engine calling Set-<span class=\"SpellE\">TargetResource<\/span> <strong>only if Test-<span class=\"SpellE\">TargetResource<\/span> returns false.<\/strong> The tool hints at this by pointing out that Test-<span class=\"SpellE\">TargetResource<\/span> should return a Boolean value. Also take note that the Get-<span class=\"SpellE\">TargetResource<\/span> function contains the <strong>key <\/strong>property as its only parameter.<\/p>\n<p class=\"MsoNormal\">Given the skeleton of the generated module, we can proceed with adding our logic. After we are done writing our resource, we need to import our new DSC module. Then we can see that it is one of the DSC resources added to the existing set:<\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span class=\"SpellE\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">PS C:\\&gt; Import-Module Demo_DSCModule<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">PS <span class=\"GramE\">C:<\/span>\\&gt; Get-<span class=\"SpellE\">DscResource<\/span> &#8216;<span class=\"SpellE\">Demo_ADUser<\/span>&#8216;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span class=\"SpellE\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">ImplementedAs<\/span><\/span><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0 Name\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Module\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Properties <\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">&#8212;&#8212;&#8212;&#8212;-\u00a0\u00a0 &#8212;-\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8212;&#8212;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8212;&#8212;&#8212;-<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">PowerShell\u00a0\u00a0\u00a0\u00a0\u00a0 <span class=\"SpellE\">Demo_ADUser<\/span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Demo_DSCModule\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 {<span class=\"SpellE\"><span class=\"GramE\">UserName<\/span><\/span><span class=\"GramE\">, \u2026<\/span> <\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\">At this point we can start writing our <a href=\"https:\/\/devblogs.microsoft.com\/powershell\/understanding-configuration-keyword-in-desired-state-configuration\/\">DSC configuration scripts<\/a> using our new resource.<\/p>\n<p class=\"MsoNormal\">All this done, you realize you also need to add one more property which would be a hash table mapping a particular user to his last log in time.\u00a0 Oh, no do you need to re write the entire resource again? No! We got you covered:<\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">S <span class=\"GramE\">C:<\/span>\\&gt; help Update-x<span class=\"SpellE\">DscResource<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">NAME<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 Update-x<span class=\"SpellE\">DscResource<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 <\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">SYNOPSIS<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 Update an existing <span class=\"SpellE\">DscResource<\/span> based on the given arguments.<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 <\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 <\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">SYNTAX<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 Update-<span class=\"SpellE\">DscResource<\/span> [-<span class=\"SpellE\">Name<\/span>] &lt;String&gt; [-Property] &lt;<span class=\"SpellE\"><span class=\"GramE\">DscResourceProperty<\/span><\/span><span class=\"GramE\">[<\/span>]&gt; [-<span class=\"SpellE\">ClassVersion<\/span> <\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 &lt;Version&gt;] [-Force] [-WhatIf] [-Confirm]\u00a0[&lt;<span class=\"SpellE\">CommonParameters<\/span>&gt;]<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 Update-DscResource [-Path] &lt;String&gt; [-Property] &lt;DscResourceProperty[]&gt; [-ClassVersion<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 &lt;Version&gt;] [-Force] [-WhatIf] [-Confirm]\u00a0[&lt;<span class=\"SpellE\">CommonParameters<\/span>&gt;]<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 <\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">DESCRIPTION<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 Update the .psm1 and .<span class=\"SpellE\">schema.mof<\/span> file representing a <span class=\"SpellE\"><span class=\"GramE\">Dsc<\/span><\/span> Resource based on the properties and values <\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 <span class=\"GramE\">passed<\/span> in.<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 <\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">RELATED LINKS<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">REMARKS<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 To see the examples, type: &#8220;get-help Update-x<span class=\"SpellE\">DscResource<\/span> -examples&#8221;.<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 For more information, type: &#8220;get-help Update-x<span class=\"SpellE\">DscResource<\/span> -detailed&#8221;.<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 For technical information, type: &#8220;get-help Update-x<span class=\"SpellE\">DscResource<\/span> -full&#8221;. <\/span><\/p>\n<p class=\"MsoNormal\">So cool. Let us add the new property:<\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">PS <span class=\"GramE\">C:<\/span>\\&gt; $<span class=\"SpellE\">lastLogOn<\/span> = New-x<span class=\"SpellE\">DscResourceProperty<\/span> -Name <span class=\"SpellE\">LastLogOn<\/span> -Type <span class=\"SpellE\">Hashtable<\/span> -Attribute Write -Description &#8220;For mapping users to their last log on time&#8221; <\/span><\/p>\n<p class=\"MsoNormal\">Let us now update our resource:<\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">PS <span class=\"GramE\">C:<\/span>\\&gt;\u00a0Update-x<span class=\"SpellE\">DscResource<\/span> &#8211;<span class=\"SpellE\">Name<\/span> &#8216;<span class=\"SpellE\">Demo_ADUser<\/span>&#8216; -Property $<span class=\"SpellE\">UserName<\/span>, $Ensure, $<span class=\"SpellE\">DomainCredential<\/span>, $Password, $<span class=\"SpellE\">lastLogOn<\/span> -Force <\/span><\/p>\n<p class=\"MsoNormal\">The contents of <span class=\"SpellE\">ADUser.schema.mof<\/span> have been updated:<\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">[<span class=\"SpellE\"><span class=\"GramE\">ClassVersion<\/span><\/span><span class=\"GramE\">(<\/span>&#8220;1.0.0.0&#8221;), <span class=\"SpellE\">FriendlyName<\/span>(&#8220;&#8221;)]<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span class=\"GramE\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">class<\/span><\/span><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\"> <span class=\"SpellE\">ADUser<\/span> : <span class=\"SpellE\">OMI_BaseResource<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">{<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 [Key] String <span class=\"SpellE\">UserName<\/span>;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 [Write, <span class=\"SpellE\"><span class=\"GramE\">ValueMap<\/span><\/span><span class=\"GramE\">{<\/span>&#8220;<span class=\"SpellE\">Present&#8221;,&#8221;Absent<\/span>&#8220;}, Values{&#8220;<span class=\"SpellE\">Present&#8221;,&#8221;Absent<\/span>&#8220;}] String Ensure;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 [Write, <span class=\"SpellE\"><span class=\"GramE\">EmbeddedInstance<\/span><\/span><span class=\"GramE\">(<\/span>&#8220;<span class=\"SpellE\">MSFT_Credential<\/span>&#8220;)] String <span class=\"SpellE\">DomainAdminCredential<\/span>;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 [Write, <span class=\"SpellE\"><span class=\"GramE\">EmbeddedInstance<\/span><\/span><span class=\"GramE\">(<\/span>&#8220;<span class=\"SpellE\">MSFT_Credential<\/span>&#8220;)] String Password;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 [Write, <span class=\"SpellE\"><span class=\"GramE\">EmbeddedInstance<\/span><\/span><span class=\"GramE\">(<\/span>&#8220;<span class=\"SpellE\">MSFT_KeyValuePair<\/span>&#8220;), Description(&#8220;For mapping users to their last log on time&#8221;)] String <span class=\"SpellE\">LastLogOn<\/span>;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">};<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\">If you take a look at the resource module, you will find that it has been updated too with the new parameter while all the logic you added are intact.<\/p>\n<p class=\"MsoNormal\">Let us cover one more cmdlet exposed by the designer tool:<\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">PS <span class=\"GramE\">C:<\/span>\\&gt; help Test-<span class=\"SpellE\">DscSchema<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">NAME<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 Test-x<span class=\"SpellE\">DscSchema<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 <\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">SYNTAX<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 Test-<span class=\"SpellE\">DscSchema<\/span> [-Path] &lt;string&gt; [-IncludeError] [&lt;CommonParameters&gt;]\u00a0 <\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 <\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">ALIASES<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 None<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 <\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">REMARKS<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 None <\/span><\/p>\n<p class=\"MsoNormal\">You may have written a MOF schema by hand and want to test whether it will satisfy the conditions required by DSC. You could use the Test-x<span class=\"SpellE\">DscSchema<\/span>. Suppose we had the following schema:<\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">[<span class=\"SpellE\"><span class=\"GramE\">ClassVersion<\/span><\/span><span class=\"GramE\">(<\/span>&#8220;1.0.0.0&#8221;), <span class=\"SpellE\">FriendlyName<\/span>(&#8220;&#8221;)]<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span class=\"GramE\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">class<\/span><\/span><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\"> <span class=\"SpellE\">Demo_ADUser<\/span> : <span class=\"SpellE\">OMI_BaseResource<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">{<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 [Key] String <span class=\"SpellE\">UserName<\/span>;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 [Write, <span class=\"SpellE\"><span class=\"GramE\">ValueMap<\/span><\/span><span class=\"GramE\">{<\/span>&#8220;<span class=\"SpellE\">Present&#8221;,&#8221;Absent<\/span>&#8220;}, Values{&#8220;<span class=\"SpellE\">Present&#8221;,&#8221;Absent<\/span>&#8220;}] String Ensure;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">};<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: white; line-height: normal; margin-bottom: 0pt;\"><span style=\"font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\">Say we save it as <span class=\"SpellE\">buggy.schema.mof<\/span>.<\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">PS <span class=\"GramE\">C:<\/span>\\&gt; Test-x<span class=\"SpellE\">DscSchema<\/span> -Path .\\<span class=\"SpellE\">buggy.schema.mof<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: red; font-family: 'Lucida Console'; font-size: 9pt;\">Test-<span class=\"SpellE\"><span class=\"GramE\">MockSchema<\/span><\/span><span class=\"GramE\"> :<\/span> The Class name <span class=\"SpellE\">Demo_ADUser<\/span> does not match the Schema name buggy.<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: red; font-family: 'Lucida Console'; font-size: 9pt;\">At C:\\Program <\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: red; font-family: 'Lucida Console'; font-size: 9pt;\">Files\\WindowsPowerShell\\Modules\\DSCPack_ResourceDesigner\\DSCPack_ResourceDesigner.psm1:2454 char<span class=\"GramE\">:21<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: red; font-family: 'Lucida Console'; font-size: 9pt;\">+\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span class=\"GramE\">return<\/span> (Test-<span class=\"SpellE\">MockSchema<\/span> $Schema $<span class=\"SpellE\">SchemaCimClass<\/span>)<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: red; font-family: 'Lucida Console'; font-size: 9pt;\">+\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: red; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 + <span class=\"SpellE\">CategoryInfo<\/span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 : <span class=\"SpellE\">NotSpecified<\/span>: (:) [Write-Error], <span class=\"SpellE\">WriteErrorException<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: red; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0\u00a0\u00a0 + <span class=\"SpellE\"><span class=\"GramE\">FullyQualifiedErrorId<\/span><\/span><span class=\"GramE\"> :<\/span> <span class=\"SpellE\">ClassNameSchemaNameDifferentError,Test-MockSchema<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: red; font-family: 'Lucida Console'; font-size: 9pt;\">\u00a0<\/span><\/p>\n<p class=\"MsoNormal\" style=\"background: #012456; line-height: normal; margin-bottom: 0pt;\"><span style=\"color: whitesmoke; font-family: 'Lucida Console'; font-size: 9pt;\">False <\/span><\/p>\n<p class=\"MsoNormal\">There you go, it complains that the name of the class and the schema should be the same.<\/p>\n<p class=\"MsoNormal\">In this post we explored the Resource Designer Tool and saw how easy it is to create our own custom DSC resources. Hope you find it useful!<\/p>\n<p class=\"MsoNormal\">Given below are the rules which a DSC resource must conform to (this is just for reference and you do not need to worry about them if you use the designer tool):<\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -0.25in;\">1)<span style=\"line-height: 106%; font-family: 'Times New Roman','serif'; font-size: 7pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>At least one parameter in the schema is marked as [key]<\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -0.25in;\">2)<span style=\"line-height: 106%; font-family: 'Times New Roman','serif'; font-size: 7pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>All parameters MUST be marked with either key, required, write or read property. Additional rules as follows:<\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -0.25in; margin-left: 1in;\">a.<span style=\"line-height: 106%; font-family: 'Times New Roman','serif'; font-size: 7pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>[Read] and ([key] or [required] or [write]) can\u2019t coexist.<\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -0.25in; margin-left: 1in;\">b.<span style=\"line-height: 106%; font-family: 'Times New Roman','serif'; font-size: 7pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>If multiple qualifiers are specified except [Read], then [key] takes precedence.<\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -0.25in; margin-left: 1in;\">c.<span style=\"line-height: 106%; font-family: 'Times New Roman','serif'; font-size: 7pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>If [write] and [required] are specified, then [required] takes precedence.<\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -0.25in;\">3)<span style=\"line-height: 106%; font-family: 'Times New Roman','serif'; font-size: 7pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Class from <span class=\"SpellE\">EmbeddedInstance<\/span> MUST be either DSC system class or a class defined in the same scope. <span class=\"SpellE\">EmbeddedInstance<\/span> class should not be DSC resource class i.e. derived from <span class=\"SpellE\">OMI_BaseResource<\/span> class.<\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -0.25in;\">4)<span style=\"line-height: 106%; font-family: 'Times New Roman','serif'; font-size: 7pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>All classes MUST have [<span class=\"SpellE\">ClassVersion<\/span>] qualifier.<\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -0.25in;\">5)<span style=\"line-height: 106%; font-family: 'Times New Roman','serif'; font-size: 7pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Existence of Get-<span class=\"SpellE\">TargetResource<\/span>, Set-<span class=\"SpellE\">TargetResource<\/span>, and Test-<span class=\"SpellE\">TargetResource<\/span> methods<\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -0.25in;\">6)<span style=\"line-height: 106%; font-family: 'Times New Roman','serif'; font-size: 7pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Set\/Test-<span class=\"SpellE\">TargetResource<\/span> take all [key] and [write] parameters only.<\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -0.25in;\">7)<span style=\"line-height: 106%; font-family: 'Times New Roman','serif'; font-size: 7pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Get-<span class=\"SpellE\">TargetResource<\/span> takes all [key] parameters and optionally can have [required] as well as [write] parameters<\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -0.25in;\">8)<span style=\"line-height: 106%; font-family: 'Times New Roman','serif'; font-size: 7pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Get\/Set\/Test-<span class=\"SpellE\">TargetResource<\/span> do not have any parameters not defined in the schema<\/p>\n<p class=\"MsoListParagraph\" style=\"text-indent: -0.25in;\">9)<span style=\"line-height: 106%; font-family: 'Times New Roman','serif'; font-size: 7pt;\">\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>Get\/Set\/Test-<span class=\"SpellE\">TargetResource<\/span> should have key\/required parameter marked as mandatory<\/p>\n<p class=\"MsoNormal\"><strong><em>Updated On 1\/13\/2014: Removed old version of Resource Designer Tool.\u00a0 An newer version of this resource can be found <a title=\"TechNet Script Center\" href=\"http:\/\/gallery.technet.microsoft.com\/scriptcenter\/xDscResourceDesigne-Module-22eddb29\">here<\/a>.<\/em><\/strong><\/p>\n<p class=\"MsoNormal\"><strong><em>Updated On 8\/20\/2014: Updated some syntax to reflect new version of Resource Designer Tool. <\/em><\/strong><\/p>\n<p class=\"MsoNormal\">Abhik Chatterjee<\/p>\n<p class=\"MsoNormal\">Windows PowerShell Developer<\/p>\n<p class=\"MsoNormal\">Microsoft<\/p>\n<p class=\"MsoNormal\">\n","protected":false},"excerpt":{"rendered":"<p>At the heart of Windows PowerShell Desired State Configuration are the resources. It is the resources which act behind the scenes for DSC to achieve its \u201cmake it so\u201d philosophy. DSC ships with a number of resources in-box and you can take a look here for the complete list. However, once you get started with [&hellip;]<\/p>\n","protected":false},"author":600,"featured_media":13641,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[142,150,248,251,345,348],"class_list":["post-1971","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell","tag-desired-state-configuration","tag-dsc","tag-powershell","tag-powershell-4-0","tag-windows-powershell-4-0","tag-windows-powershell-desired-state-configuration"],"acf":[],"blog_post_summary":"<p>At the heart of Windows PowerShell Desired State Configuration are the resources. It is the resources which act behind the scenes for DSC to achieve its \u201cmake it so\u201d philosophy. DSC ships with a number of resources in-box and you can take a look here for the complete list. However, once you get started with [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/1971","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\/600"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/comments?post=1971"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/1971\/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=1971"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=1971"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=1971"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}