Rundeck/WINRM - Rundeck manage to connect, move file, failing executing inline powershell script

1.8k Views Asked by At

Currently I am facing a very confusing issue.

  1. I am executing a job from (Rundeck) to (remote windows machine) using winrm as executor and file copier, which execute an inline powershell script.

  2. Tried and worked fine on one of 3 environments.

  3. On the Preprod, and Prod Rundeck.. Same job (exported/imported), fails, though same setting on the 3 environment, same script, same args, even same windows version.

  4. I added a WINRM Check connection step, and it succeeds.

WINRM Check step

  1. Rundeck manage to throw the script on the machine (with wrong name however), which means authentication is going well. However, it fails with this abstract error.

[ERROR ] Execution finished with the following error (winrm-exec.py:304)[root] [ERROR ] The parameter is incorrect. (extended fault data: {u'fault_subcode': 'w:InvalidParameter', u'fault_code': 's:Sender', u'wsmanfault_code': '87', 'transport_message': u'Bad HTTP response returned from server. Code 500', 'http_status_code': 500}) (winrm-exec.py:305)[root] [WinRMPython]: result code: 1, success: false Failed: NonZeroResultCode: [WinRMPython] Result code: 1

Failure

  1. When I try to execute the thrown Powershell script locally from the machine it works well.

WinRM plugin version: 2.0.9

Python: 2.7.17

2

There are 2 best solutions below

0
On BEST ANSWER

For future references, the solution is here. Switching to Python 3 interpreter (instead of Python 2) on Default Node Executor and Default File Copier (Project Settings > Edit Configuration > Default Node Executor and Default File copier tabs) solves the issue.

0
On

Switching to python3 in WINRM resolved the problem. However, it caused problem for Windows server 2008 and older version.

So if you have both Windows OS version [pre and post 2008], you would need to split RUNDECK projects, and have winrm available on both python2 and python3.