Rundeck Failing to execute remote powershell scripts

1,438 views
Skip to first unread message

Abraam Magued

unread,
Oct 14, 2020, 9:49:16 AM10/14/20
to rundeck-discuss
Hello,

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- I set that and worked on the DEV environment.

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. 



5- 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.



5- 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

rac...@rundeck.com

unread,
Oct 14, 2020, 9:56:42 AM10/14/20
to rundeck-discuss
Hi Abraam,

Which error are you seeing? Anyway, consider using the PyWinRM (out of the box with Rundeck) plugin instead of the old "Overthere WinRM" plugin. Here you can check the configuration and here you can check how to define your windows machine on the model source (resource.xml). Also, here you have the Windows side configuration.

Regards!

Abraam Magued

unread,
Oct 14, 2020, 10:02:44 AM10/14/20
to rundeck-discuss
Hello,

This is the 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


For the client/server configuration, the RUndeck manages to authenticate and copy the inline script. So authentication and connection is going well. 


Regards

rac...@rundeck.com

unread,
Oct 14, 2020, 11:01:30 AM10/14/20
to rundeck-discuss
Hi Abraam,

Is that happening with every Powershell script? You tested sending single commands (or a single powershell script) to a windows server and work OK? Could you share a script example to test? (please change any potentially sensitive information).

Regards.

Abraam Magued

unread,
Oct 14, 2020, 12:04:04 PM10/14/20
to rundeck...@googlegroups.com
Hello,

Same behaviour, same exact error when I execute single command step. 

Note: user with whom I execute is in administrator group, so no privilige issue. 

--
You received this message because you are subscribed to the Google Groups "rundeck-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rundeck-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rundeck-discuss/10db59fe-54f6-4bee-bd4f-9d146096dd07n%40googlegroups.com.

rac...@rundeck.com

unread,
Oct 14, 2020, 12:26:00 PM10/14/20
to rundeck-discuss

To double-check:

  1. Make sure that you’ve configured your windows box in this way.
  2. Make sure that your windows node is well defined following this.
  3. Can you test switching your interpreter to python3? (Project Settings > Edit Configuration > Default Node Executor tab > Pythonn Interpreter, same for Default File Copier tab).

Also, I did it a python code (which need WinRM python module) to test the remote windows machine with a command, can you run and test it?

import winrm

session = winrm.Session('your-windows-ip', auth=('your-user','your-password'))
result = session.run_ps("hostname")
print(result.std_out)

Can you see the “hostname” command output?

Regards!

Abraam Magued

unread,
Oct 19, 2020, 11:57:25 AM10/19/20
to rundeck...@googlegroups.com
Hello,

Actually I tried running with python3 interpreter, however it is telling me 
[ERROR ] winrm not installed, try: pip install pywinrm (winrm-exec.py:216)[root]

Checkking on the rundeck host, python3 is present. As well, when I pip list, I find pywinrm (0.4.1) available.

Any idea of how to make it use python3 properly ?

Regards,

rac...@rundeck.com

unread,
Oct 19, 2020, 12:14:05 PM10/19/20
to rundeck-discuss

Hi Abraam,

The winrm module is present if you do pip3 list command? (different to pip list). If not present, you can install it with pip3 install pywinrm.

Regards.

Abraam Magued

unread,
Oct 22, 2020, 7:34:01 AM10/22/20
to rundeck...@googlegroups.com
Hello,

Thanks a lot.. Indeed, issue is resolved when using the python3 interpreter.

rac...@rundeck.com

unread,
Oct 22, 2020, 8:17:34 AM10/22/20
to rundeck-discuss
Amazing Abraam! Good news then.

Greetings!
Reply all
Reply to author
Forward
0 new messages