# windows command from ansible / returning error

**URL:** <https://forum.ansible.com/t/windows-command-from-ansible-returning-error/28906>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [October 31, 2018, 11:02am UTC](https://forum.ansible.com/t/windows-command-from-ansible-returning-error/28906 "2018-10-31T11:02:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nadim\_mansour](https://avatars.discourse-cdn.com/v4/letter/n/a698b9/32.png) [@nadim\_mansour](https://forum.ansible.com/u/nadim_mansour)\
**Post date:** [October 31, 2018, 11:02am UTC](https://forum.ansible.com/t/windows-command-from-ansible-returning-error/28906/1 "2018-10-31T11:02:39Z")

</div>

I am trying to install oracle client in silent mode by runing the following task from ansible and its returning an error:

**- name: Install Oracle client 12.1.0.2.1**  
**win\_command: C:\tmp\ODAC121021\_x64\setup.exe -silent -responseFile C:\tmp\client.rsp**  
**ignore\_errors: yes**

**The error is:**

 ![Screen Shot 2018-10-31 at 1.01.32 PM.png](https://us1.discourse-cdn.com/ansible/original/2X/3/3cac6301fb07200bb3d49226a62229c5c9ec13c4.png)

fatal: [uat\_cdxdb]: FAILED! =\> {“changed”: true, “cmd”: “C:\tmp\ODAC121021\_x64\setup.exe -silent -responseFile C:\tmp\client.rsp”, “delta”: “0:00:15.234405”, “end”: “2018-10-11 07:50:06.842169”, “msg”: “non-zero return code”, “rc”: 259, “start”: “2018-10-11 07:49:51.607764”, “stderr”: “”, “stderr\_lines”: , “stdout”: “\r\n Exit code of OUI process 259=”, “stdout\_lines”: [“”, " Exit code of OUI process 259="]}

**If I run the command directly from windows, directly through power shell its working**

---

<div class="post-metadata">

**Author:** ![jborean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jborean/32/1525_2.png) [@jborean](https://forum.ansible.com/u/jborean)\
**Post date:** [October 31, 2018, 11:35am UTC](https://forum.ansible.com/t/windows-command-from-ansible-returning-error/28906/2 "2018-10-31T11:35:46Z")

</div>

You would need to find out what an error code of 259 means in the context of the installer. When you run it locally are you getting the same return code, in powershell this is set to ‘$LASTEXITCODE’, in cmd.exe you can get the last rc with ‘echo %ERRORLEVEL%’.

Thanks

Jordan

---

<div class="post-metadata">

**Author:** ![nadim\_mansour](https://avatars.discourse-cdn.com/v4/letter/n/a698b9/32.png) [@nadim\_mansour](https://forum.ansible.com/u/nadim_mansour)\
**Post date:** [October 31, 2018, 12:45pm UTC](https://forum.ansible.com/t/windows-command-from-ansible-returning-error/28906/3 "2018-10-31T12:45:30Z")

</div>

when I run it locally on windows server the command is working and oracle client is installed silently

---

<div class="post-metadata">

**Author:** ![jborean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jborean/32/1525_2.png) [@jborean](https://forum.ansible.com/u/jborean)\
**Post date:** [October 31, 2018, 12:52pm UTC](https://forum.ansible.com/t/windows-command-from-ansible-returning-error/28906/4 "2018-10-31T12:52:19Z")

</div>

Ok so you need to fix out what error 259 means. Look to see if you can enable any logging to identify the issue, this would all be specific to that installer so start with the company that produces it and read through their docs.

---

<div class="post-metadata">

**Author:** ![jborean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jborean/32/1525_2.png) [@jborean](https://forum.ansible.com/u/jborean)\
**Post date:** [November 1, 2018, 10:11am UTC](https://forum.ansible.com/t/windows-command-from-ansible-returning-error/28906/5 "2018-11-01T10:11:10Z")

</div>

Also as an FYI, normally an rc of 259 means the process is still active [1] which tells me the installer is still running in the background. I do remember seeing an issue with the Oracle installer not working in Ansible and exits straight away and there’s a special command line argument or response file value you must set for it to wait until the installer is complete. Have a look at the setup.exe documentation and see what you can find.

This may not be the case with the Oracle installer as the code could mean something else but this scenario does sound familiar.

[1] [https://docs.microsoft.com/en-us/windows/desktop/api/processthreadsapi/nf-processthreadsapi-getexitcodeprocess](https://docs.microsoft.com/en-us/windows/desktop/api/processthreadsapi/nf-processthreadsapi-getexitcodeprocess)
