I am trying to create a service of type kernel on a remote windows 10 
machine from a linux ansible controller machine. To create a service I'm 
using *sc create* *type=kernel binpath=c:\path * command. 

Ansible playbook for creating a service:
- hosts: windows
  tasks:
     - name: Create temp service
       raw: sc create temp type=kernel binpath=c:\path\


And I'm getting the following error:

TASK [Create temp service on windows] 
****************************************
fatal: [10.x.x.x]: FAILED! => {"changed": false, "failed": true, "rc": 1, 
"stderr": "#< CLIXML\r\n<Objs Version=\"1.1.0.1\" xmlns=\"
http://schemas.microsoft.com/powershell/2004/04\ 
<http://schemas.microsoft.com/powershell/2004/04/>"><Obj S=\"progress\" 
RefId=\"0\"><TN 
RefId=\"0\"><T>System.Management.Automation.PSCustomObject</T><T>System.Object</T></TN><MS><I64
 
N=\"SourceId\">1</I64><PR N=\"Record\"><AV>Preparing modules for first 
use.</AV><AI>0</AI><Nil 
/><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> 
</SD></PR></MS></Obj><S S=\"Error\">Set-Content : A positional parameter 
cannot be found that accepts argument 'type=kernel'._x000D__x000A_</S><S 
S=\"Error\">At line:1 char:1_x000D__x000A_</S><S S=\"Error\">+ sc create 
temp type=kernel binpath=c:\\windows\\ ..._x000D__x000A_</S><S 
S=\"Error\">+ 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~_x000D__x000A_</S><S
 
S=\"Error\">    + CategoryInfo          : InvalidArgument: (:) 
[Set-Content], ParameterBindingException_x000D__x000A_</S><S 
S=\"Error\">    + FullyQualifiedErrorId : 
PositionalParameterNotFound,Microsoft.PowerShell.Commands.SetContentCommand_x000D__x000A_</S><S
 
S=\"Error\"> _x000D__x000A_</S></Objs>", "stdout": "", "stdout_lines": []}



What could be the exact reason? Or is there any other of creating a service 
on a windows machine?

-- 
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/8cf9a0ae-91f0-4b1b-a871-51725ab9eb0e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to