Ansible playbook failing on Ansible but completing on target machine

Hello,

I have just started to use Ansible to complete some automation aspects on the Windows platform. My first task was to run our power shell script to install out Anti Virus software.

I was able to achieve this by creating a bat file that calls the power shell script with psexec. The bat file runs with elevated privileges allowing the script to work. The Ansible playbook completes with a psexec error and says the playbook fails. But when I look at the machine this script completes successfully. Below is the error I receive:

fatal:
[IP]: FAILED! => {"changed": true, "delta":
"0:00:00.749984", "end": "2017-12-11
07:32:08.172137", "failed": true, "psexec_command":
"c:\\PSTools\\psexec.exe -accepteula psexec -u administrator -p force -s
-d cmd.exe /c \"C:\\ansible\\av\\av-use.bat\"", "rc":
1412, "start": "2017-12-11 07:32:07.422153",
"stderr": "psexec exited with error code 1412.\r\n",
"stderr_lines": ["psexec exited with error code 1412."],
"stdout": "\r\nPsExec v2.2 - Execute processes
remotely\r\nCopyright (C) 2001-2016 Mark Russinovich\r\nSysinternals -
[www.sysinternals.com](http://www.sysinternals.com/)\r\n\r\n", "stdout_lines": ["",
"PsExec v2.2 - Execute processes remotely", "Copyright (C)
2001-2016 Mark Russinovich", "Sysinternals - [www.sysinternals.com](http://www.sysinternals.com/)",
""]}

I have also received the same sort of error with the Amazon SSM script as well. This script completes too.

Does anyone have any insight on this false negative? I am trying to chain several things together in my playbook, but once this script fails, the playbook stops.

Thank you in advance!

Josh

Hi Josh,

**ERROR_CLASS_HAS_WINDOWS**
1412 (0x584)

Class still has open windows.

I would say what is happening is the script is doing what it should but there is window hanging around afterwards, possibly some confirmation dialog. Either look at changing the script and installer to finish (end exit) successfully, or add some failed_when clauses to the task.

having the change implemented and related scripts terminate properly are two different things.