{"id":83025,"date":"2018-05-23T00:01:59","date_gmt":"2018-05-23T07:01:59","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/?p=83025"},"modified":"2019-02-18T09:09:58","modified_gmt":"2019-02-18T16:09:58","slug":"run-powershell-code-in-puppet","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/run-powershell-code-in-puppet\/","title":{"rendered":"Run PowerShell code in Puppet"},"content":{"rendered":"<p><strong>Summary:<\/strong> Hi everyone, Dan Franciscus here. I\u2019m a systems engineer and freelance technical writer based out of New Jersey. My expertise is in Windows Server, PowerShell, VMware, and Puppet. Puppet is an infrastructure platform that helps automate your environment. While Puppet has a large Linux user base, it also supports the configuration of Windows systems.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>Normally, it\u2019s preferable to use specific Puppet and DSC Windows modules to manage systems in Puppet, but an alternative is running PowerShell commands and scripts by using the <strong>exec<\/strong> resource. This can be helpful for transitioning existing PowerShell code into Puppet quickly.<\/p>\n<p>The <strong>exec<\/strong> resource allows you to execute shell commands on your nodes. Fortunately, Puppet also allows users to change the provider used for the <strong>exec<\/strong> resource to PowerShell, so that Windows Puppet nodes will run PowerShell commands.<\/p>\n<p>For instance, in this example manifest, I want to run a PowerShell command that adds the string \u201cHello\u201d to the contents of a text file (\u201cC:\\test.txt\u201d) for my Puppet node (\u201cTest-1\u201d).<\/p>\n<p><em>node \u2018Test-1&#8242; {<\/em><\/p>\n<p><em>exec { &#8216;SETHELLO&#8217;:<\/em><\/p>\n<p><em>\u00a0 \u00a0 \u00a0 command\u00a0\u00a0 =&gt; &#8216;Add-Content -Path c:\\test.txt \u2013Value \u201cHello\u201d\u2019,<\/em><\/p>\n<p><em>\u00a0 \u00a0 \u00a0 logoutput =&gt; true,<\/em><\/p>\n<p><em>\u00a0 \u00a0 \u00a0 provider\u00a0 =&gt; powershell,<\/em><\/p>\n<p><em>\u00a0 \u00a0 \u00a0 }<\/em><\/p>\n<p><em>} <\/em><\/p>\n<p>The three parameters I use in this manifest are <strong>command<\/strong>, <strong>logoutput <\/strong>and <strong>provider<\/strong>. The <strong>command <\/strong>parameter is the PowerShell code you want to run on your node. The <strong>logoutput <\/strong>parameter just logs the output to the console. Finally, <strong>provider<\/strong> is necessary to declare that PowerShell is the shell to use in this resource, instead of BASH by default.<\/p>\n<p>When I run <strong>puppet agent <\/strong>on my Test-1 node, I get this output:<\/p>\n<p><em>PS C:\\&gt; puppet agent &#8211;test \u00a0<\/em><\/p>\n<p><em>Info: Retrieving pluginfacts\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\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/em><\/p>\n<p><em>Info: Retrieving plugin\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\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/em><\/p>\n<p><em>Info: Loading facts\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\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/em><\/p>\n<p><em>Info: Caching catalog for Test-1 \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<\/em><\/p>\n<p><em>Info: Applying configuration version &#8216;1524181853&#8217;\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<\/em><\/p>\n<p><em>Notice: \/Stage[main]\/Main\/Node[Test-1 ]\/Exec[SETHELLO]\/returns: executed successfully<\/em><\/p>\n<p><em>Notice: Finished catalog run in 1.91 seconds<\/em><\/p>\n<p>If I run <strong>Get-Content<\/strong> on c:\\test.txt, I see Puppet did its job by adding \u201cHello\u201d:<\/p>\n<p><em>PS C:\\&gt; Get-Content C:\\test.txt\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\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/em><\/p>\n<p><em>Hello<\/em><\/p>\n<p>You can see from the output, Puppet ran the <strong>Add-Content<\/strong> command successfully. This is fine, but with configuration management we usually want to make our configurations idempotent. In other words, we want the same effect on a node each time we run it, regardless of how many times. In this case, I only want \u201cHello\u201d to be added to c:\\test.txt when it does not already exist in the file. To make this resource idempotent, I will use the <strong>unless<\/strong> parameter in my manifest. In the <strong>unless<\/strong> parameter, I will look into the file with <strong>Select-String<\/strong> to see if the \u201cHello\u201d string is present. If it is not present, Puppet adds \u201cHello\u201d to c:\\test.txt with <strong>Add-Content<\/strong>.<\/p>\n<p><em>node &#8216;puppetagent-win&#8217; {<\/em><\/p>\n<p><em>\u00a0 \u00a0 \u00a0 exec { &#8216;SETHELLO&#8217;:<\/em><\/p>\n<p><em>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0 command\u00a0\u00a0 =&gt; &#8216;Add-Content -Path c:\\test.txt -Value &#8220;Hello&#8221;&#8216;,<\/em><\/p>\n<p><em>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0 unless =&gt; &#8216;if (!(Select-String -Path c:\\test.txt -Pattern &#8220;Hello&#8221;)){exit 1}&#8217;,<\/em><\/p>\n<p><em>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0 logoutput =&gt; true,<\/em><\/p>\n<p><em>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0 provider\u00a0 =&gt; powershell,<\/em><\/p>\n<p><em>\u00a0 \u00a0 \u00a0 }<\/em><\/p>\n<p><em>}<\/em><\/p>\n<p>There is an alternative to the <strong>unless<\/strong> parameter. You can use <strong>onlyif<\/strong>, which only runs what is in the <strong>command<\/strong> parameter if the command in <strong>onlyif<\/strong> returns an exit code of 0.<\/p>\n<p>Now on my node, I first illustrate that there is nothing in the contents of c:\\test.txt by setting the value to $Null:<\/p>\n<p><em>PS C:\\&gt; Set-Content -Value $Null -Path C:\\test.txt\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 <\/em><\/p>\n<p><em>PS C:\\&gt; Get-Content -Path C:\\test.txt\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\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/em><\/p>\n<p><em>PS C:\\&gt;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/em><\/p>\n<p>Next, I run <strong>puppet agent<\/strong>, which adds the \u201cHello\u201d string to c:\\test.txt since <strong>Select-String<\/strong> does not find it:<\/p>\n<p><em>PS C:\\&gt; puppet agent &#8211;test \u00a0<\/em><\/p>\n<p><em>Info: Retrieving pluginfacts\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\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/em><\/p>\n<p><em>Info: Retrieving plugin\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\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/em><\/p>\n<p><em>Info: Loading facts\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\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/em><\/p>\n<p><em>Info: Caching catalog for Test-1 \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<\/em><\/p>\n<p><em>Info: Applying configuration version &#8216;1524332621&#8217;\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 <\/em><\/p>\n<p><strong><em>Notice: \/Stage[main]\/Main\/Node[Test-1 ]\/Exec[SETHELLO]\/returns: executed successfully<\/em><\/strong><\/p>\n<p><em>Notice: Finished catalog run in 2.97 seconds\u00a0 <\/em><\/p>\n<p>As you can see with <strong>Get-Content<\/strong>, Puppet added the \u201cHello\u201d string to c:\\test.txt:<\/p>\n<p><em>PS C:\\&gt; Get-Content \u2013Path C:\\test.txt\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\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/em><\/p>\n<p><em>Hello\u00a0 <\/em><\/p>\n<p>Finally, if I run <strong>puppet agent<\/strong> on the node again, nothing is done. This is because the <strong>unless<\/strong> parameter has an exit code of 0, meaning \u201cHello\u201d was found in c:\\test.txt:<\/p>\n<p><em>PS C:\\&gt; puppet agent &#8211;test \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<\/em><\/p>\n<p><em>Info: Retrieving pluginfacts\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\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/em><\/p>\n<p><em>Info: Retrieving plugin\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\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/em><\/p>\n<p><em>Info: Loading facts\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\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/em><\/p>\n<p><em>Info: Caching catalog for Test-1 \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<\/em><\/p>\n<p><em>Info: Applying configuration version &#8216;1524333018&#8217;\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 <\/em><\/p>\n<p><em>Notice: Finished catalog run in 1.89 seconds\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 <\/em><\/p>\n<p><em>PS C:\\&gt; Get-Content -Path C:\\test.txt\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\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/em><\/p>\n<p><em>Hello\u00a0\u00a0\u00a0 <\/em><\/p>\n<p>I hope this gives you some insight into how to use PowerShell with Puppet to manage and automate the configuration of your Windows systems. For more information on using Puppet with Windows, you can visit <a target=\"_blank\" href=\"https:\/\/puppet.com\/resources\/webinar\/windows-webinar-series?ls=Campaigns&amp;lsd=Paid-Search&amp;cid=7010f0000011MZQ&amp;utm_medium=paid-search&amp;utm_campaign=Q1FY19_WW_All_DEMAND_SER_ADWRDS_wndw-web|mkto-less-30&amp;utm_source=google&amp;utm_content=windows-webinar&amp;gc\" rel=\"noopener\">puppet.com<\/a> and view their 9-part webinar series.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Dan Franciscus, guest blogger<\/strong><\/p>\n<p>You can follow him on <a target=\"_blank\" href=\"https:\/\/twitter.com\/dan_franciscus\" rel=\"noopener\">Twitter<\/a> or read his blog <a target=\"_blank\" href=\"https:\/\/winsysblog.com\/\" rel=\"noopener\">here<\/a>.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Normally, it\u2019s preferable to use specific Puppet and DSC Windows modules to manage systems in Puppet, but an alternative is running PowerShell commands and scripts by using the <strong>exec<\/strong> resource. This can be helpful for transitioning existing PowerShell code into Puppet quickly.<\/p>\n","protected":false},"author":596,"featured_media":83293,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[568],"tags":[56,3,45],"class_list":["post-83025","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-hey-scripting-guy","tag-guest-blogger","tag-scripting-guy","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>Normally, it\u2019s preferable to use specific Puppet and DSC Windows modules to manage systems in Puppet, but an alternative is running PowerShell commands and scripts by using the <strong>exec<\/strong> resource. This can be helpful for transitioning existing PowerShell code into Puppet quickly.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/83025","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/596"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=83025"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/83025\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/83293"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=83025"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=83025"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=83025"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}