Run .exe on windows command prompt

296 views
Skip to first unread message

Jugal Porwal

unread,
Sep 28, 2015, 8:32:49 AM9/28/15
to Ansible Project
Hi,

I want to run a .exe on windows command prompt from my centos control node. The command is as follows :

wrapper.exe  -t wrapper.conf

Initially i tried to atleast run the .exe without any args using my following playbook :
---
- hosts: windows
tasks:
- name: Register as a service
raw: 'D:\builds\router\bin\wrapper.exe'


But i got the following error:

fatal: [192.168.199.94]: 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\"><S S=\"Error\">D:_x0008_uilds : The term 'D:_x0008_uilds' is not recognized as the name of a cmdlet, _x000D__x000A_</S><S S=\"Error\">function, script file, or operable program. Check the spelling of the name, or _x000D__x000A_</S><S S=\"Error\">if a path was included, verify that the path is correct and try again._x000D__x000A_</S><S S=\"Error\">At line:1 char:1_x000D__x000A_</S><S S=\"Error\">+ D:_x0008_uilds_x000D__x000A_</S><S S=\"Error\">+ ~~~~~~~~_x000D__x000A_</S><S S=\"Error\">    + CategoryInfo          : ObjectNotFound: (D:_x0008_uilds:String) [], CommandNot _x000D__x000A_</S><S S=\"Error\">   FoundException_x000D__x000A_</S><S S=\"Error\">    + FullyQualifiedErrorId : CommandNotFoundException_x000D__x000A_</S><S S=\"Error\"> _x000D__x000A_</S><S S=\"Error\">outer_x0008_in\\wrapper.exe : The module 'outer_x0008_in' could not be loaded. For more _x000D__x000A_</S><S S=\"Error\">information, run 'Import-Module outer_x0008_in'._x000D__x000A_</S><S S=\"Error\">At line:2 char:1_x000D__x000A_</S><S S=\"Error\">+ outer_x0008_in\\wrapper.exe_x000D__x000A_</S><S S=\"Error\">+ ~~~~~~~~~~~~~~~~~~~~_x000D__x000A_</S><S S=\"Error\">    + CategoryInfo          : ObjectNotFound: (outer_x0008_in\\wrapper.exe:String) [] _x000D__x000A_</S><S S=\"Error\">   , CommandNotFoundException_x000D__x000A_</S><S S=\"Error\">    + FullyQualifiedErrorId : CouldNotAutoLoadModule_x000D__x000A_</S><S S=\"Error\"> _x000D__x000A_</S></Objs>", "stdout": "", "stdout_lines": []}


Is it achievable what i'm trying to do?

Chris Church

unread,
Sep 28, 2015, 2:47:42 PM9/28/15
to ansible...@googlegroups.com
It appears as though the backslashes are escaping the character that follows (which doesn't quite make sense since your example uses a single-quoted string).   What version of ansible are you using?

You could try:    raw: "D:\\builds\\router\\bin\\wrapper.exe"


--
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-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/f7d197e0-fb20-4cbd-b4da-bae2b726bc05%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dimitri Yioulos

unread,
Sep 28, 2015, 3:57:34 PM9/28/15
to Ansible Project
Try the raw command without any quotes, as in raw: D:\builds\router\bin\wrapper.exe.  The following worked for me, and installed vlc on a test win2k8 box:

---

- hosts: all
  gather_facts: false

  tasks:
    - name: installing app ...
      raw: c:\temp\vlc-2.2.1-win32.exe /S

Balaji Chandrababu

unread,
Jan 19, 2016, 5:24:37 AM1/19/16
to Ansible Project
Hi Dimitri,

I'm trying to do pretty much the same with our own installer.

This is what i have got in the playbook.

Example:
- name: Install ZoneSense and Niva latest version
  raw: 'C:\Temp\ZoneSense 16.0.0.343.exe /S'

I tried other options as well: raw: '"C:\Temp\ZoneSense 16.0.0.343.exe" /S' and raw: "C:\\Temp\\ZoneSense 16.0.0.343.exe /S"

But none of them seems to work. It fails with the following error:


fatal: [uk-lon01-cs08.mirriad.corp]: FAILED! => {"changed": false, "failed": true, "invocation": {"module_args": {"_raw_params": "\"C:\\\\Temp\\\\ZoneSense 16.0.0.343.exe\" /S"}, "module_name": "raw"}, "rc": 1, "stderr": "#< CLIXML\r\n<Objs Version=\"1.1.0.1\" xmlns=\"http://schemas.microsoft.com/powershell/2004/04\"><S S=\"Error\">At line:1 char:39_x000D__x000A_</S><S S=\"Error\">+ \"C:\\\\Temp\\\\ZoneSense 16.0.0.343.exe\" /S_x000D__x000A_</S><S S=\"Error\">+                                       ~_x000D__x000A_</S><S S=\"Error\">You must provide a value expression following the '/' operator._x000D__x000A_</S><S S=\"Error\">At line:1 char:39_x000D__x000A_</S><S S=\"Error\">+ \"C:\\\\Temp\\\\ZoneSense 16.0.0.343.exe\" /S_x000D__x000A_</S><S S=\"Error\">+                                       ~_x000D__x000A_</S><S S=\"Error\">Unexpected token 'S' in expression or statement._x000D__x000A_</S><S S=\"Error\">    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException_x000D__x000A_</S><S S=\"Error\">    + FullyQualifiedErrorId : ExpectedValueExpression_x000D__x000A_</S><S S=\"Error\"> _x000D__x000A_</S></Objs>", "stdout": "", "stdout_lines": []}

Please let me know how to workaround this.

Thanks,
Balaji

Sharwari Phadnis

unread,
Apr 8, 2016, 10:21:31 AM4/8/16
to Ansible Project
Did you find any solution for this? If you've please help, I'm facing the same issue.

Dimitri Yioulos

unread,
Apr 8, 2016, 3:32:12 PM4/8/16
to Ansible Project
Once again, I'd suggest trying the raw command without quotes:

raw: c:\temp\vlc-2.2.1-win32.exe /S


On Monday, September 28, 2015 at 8:32:49 AM UTC-4, Jugal Porwal wrote:
Reply all
Reply to author
Forward
0 new messages