Hi 

I am trying to run a simple playbook to run a Powershell script. But it 
keeps failing.
If I run the Powershell script directly on the server it works fine. Below 
is the play book ans the script.

Is there something that needs to be done to get Ansible to run the 
Powershell script?

Powershell Scripts (rdp.ps1)

# Enable Remote Desktop
set-ItemProperty -Path 'HKLM:SystemCurrentControlSetControlTerminal 
Server'-name "fDenyTSConnections" -Value 0


Playbook:

---
- name: Enable Remote Desktop on
  hosts: all
  tasks:
    - name: Enable Remote Desktop
      script: files/Enable_RDP.ps1


Error:
changed: [10.10.3.170] => {"changed": true, "invocation": {"module_args": 
{"_raw_params": "files/Enable_RDP.ps1"}, "module_name": "script"}, "rc": 0, 
"stderr": "#< CLIXML\r\n<Objs Version=\"1.1.0.1\" 
xmlns=\"http://schemas.microsoft.com/powershell/2004/04\";><S 
S=\"Error\">set-ItemProperty : Cannot find path _x000D__x000A_</S><S 
S=\"Error\">'HKLM:\\SystemCurrentControlSetControlTerminal Server' because 
it does not _x000D__x000A_</S><S S=\"Error\">exist._x000D__x000A_</S><S 
S=\"Error\">At 
C:\\Users\\Administrator\\AppData\\Local\\Temp\\ansible-tmp-1454943953.17-24292631_x000D__x000A_</S><S
 
S=\"Error\">07433\\Enable_RDP.ps1:2 char:1_x000D__x000A_</S><S 
S=\"Error\">+ set-ItemProperty -Path 
'HKLM:SystemCurrentControlSetControlTerminal _x000D__x000A_</S><S 
S=\"Error\">Server'-name ..._x000D__x000A_</S><S S=\"Error\">+ 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~_x000D__x000A_</S><S
 
S=\"Error\">~~~_x000D__x000A_</S><S S=\"Error\"> + CategoryInfo : 
ObjectNotFound: (HKLM:\\SystemCur...Terminal Serv _x000D__x000A_</S><S 
S=\"Error\"> er:String) [Set-ItemProperty], 
ItemNotFoundException_x000D__x000A_</S><S S=\"Error\"> + 
FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetIt 
_x000D__x000A_</S><S S=\"Error\"> emPropertyCommand_x000D__x000A_</S><S 
S=\"Error\"> _x000D__x000A_</S></Objs>", "stdout": "", "stdout_lines": []} 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/7541a9d6-82da-4c19-a5a9-66da188701ce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to