Powershell Resource - New-RDSessionDeployment


Fairly new and having an issue with getting a Powershell resource to run.

I am trying to automate installing RDS on a windows 2016 server. I have a seperate recipe that installs the RDS features which works great and then I have another that is supposed to create the deployment which I have the issue with.

The powershell command works fine when run locally on the node and I can see the script is correct when it is created on the node, but nothing seems to happen. The recipe just runs without error and that's it.


Cookbook:: blahblah

Recipe:: Deployment

Copyright:: 2019, The Authors, All Rights Reserved.

return unless node['platform'] == 'windows'

powershell_script 'New_SessionDeployment' do
code <<-EOH
New-RDSessionDeployment -WebAccessServer "vagrant.test.local" -SessionHost "vagrant.test.local" -ConnectionBroker "vagrant.test.local"
guard_interpreter :powershell_script


   Recipe: blahblah::Deployment
     * powershell_script[New_SessionDeployment] action run
       - execute "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Users/vagrant/AppData/Local/Temp/chef-scri-3428-1l661pd.ps1"

   Running handlers:
   Running handlers complete
   Chef Client finished, 1/1 resources updated in 22 seconds

I've tried running as a different account and elevated but no joy. Can anyone help?