win_shell task failing with ansible error: Get-AnsibleParam: Missing required argument: _raw_params

Ansible version: 2.6.1 (and I tried with 2.7.0 development branch as well)

I have a simple win_shell task though which I am trying to execute powershell script which is sitting on the remote system. I have verified the path and the existence of script.

  • name: DPS Server Installation

win_shell:

args: C:\temp\nd6.1.1.20.7\Scripts\nd.Install\Install-DPS.ps1

Ansible keeps failing with the following error message:

TASK [DPS Server Installation] ***********************************************************************************************************

fatal: [i-01f6259784352dff3]: FAILED! => {“changed”: false, “msg”: “Get-AnsibleParam: Missing required argument: _raw_params”}

to retry, use: --limit @/mnt/c/GitHub/alikha-spnd/autosp.retry

Have a look at the examples in the module documentation https://docs.ansible.com/ansible/latest/modules/win_shell_module.html#examples and you’ll see the format is a little different.
This ought to run your script.

You might want to use the script module which can deliver your script to the remote machine and run it in the same step (script also works for windows targets).

  • name: DPS Server Installation

win_shell: C:\temp\nd6.1.1.20.7\Scripts\nd.Install\Install-DPS.ps1

Hope this helps,

Jon