title: Puppet for Windows and Powershell Recipes
body: <p>I am trying to set some powershell inline cmdlets within puppet recipes in order to install other msi packages and powershell scripts.</p>
  
  <pre><code>class ps{
      #http://docs.puppetlabs.com/windows/running.html
  
      exec {'executionpolicy':
          path =&gt; 'C:\Windows\sysnative\WindowsPowerShell\v1.0', 
          command =&gt; 'Powershell.exe "Set-ExecutionPolicy Unrestricted -Force -Verbose"',
          logoutput =&gt; true
          }
  
      exec {'psremoting':
          path =&gt; 'C:\Windows\sysnative\WindowsPowerShell\v1.0', 
          command =&gt; 'Powershell.exe "Enable-PSRemoting -Force -Verbose"',
          logoutput =&gt; true,
          require =&gt; Exec["executionpolicy"]
          } 
      exec {'psmemory':
          path =&gt; 'C:\Windows\sysnative\WindowsPowerShell\v1.0', 
          command =&gt; 'Powershell.exe "Set-Item WSMan:\localhost\Shell\MaxMemoryPerShellMB 2048"',
          logoutput =&gt; true,
          require =&gt; [Exec["psremoting"],Exec["executionpolicy"]]
      }
  }
  </code></pre>
  
  <p>I am getting different errors and i was thinking on changing the approach and add those inline cmdlets into a .ps1 script. Any recommendations on running powershell inline scripts as puppet recipes?</p>
  
  <p>Thanks.</p>