Hi All
I’ve been working on an Ansible module that allows you to run a command on a Windows host remotely without the need for WinRM and in the end I’ve created a module called psexec to do this. If any Windows admins (or others who wish to try it out) are interested you can find the PR here https://github.com/ansible/ansible/pull/36723 and try it out. Some of the things you can do with this module are;
- Run an adhoc command on a remote Windows host without WinRM being setup and enabled
- Use it to do bootstrapping tasks that would be otherwise hard to run in some environments, e.g. setting up the WinRM listeners or upgrading PowerShell to the 3.0 requirement
- Runs on Python/linux so no requirement for another Windows host like win_psexec and is easily runnable on the Ansible controller
- Fine control over the process and how it is executed, e.g. become like options to run as a different user or the System account
It is no substitution for the winrm connection plugin as it does not use a proper protocol but rather takes advantage of some internal Windows mechanisms to run a process.
Some more links if you are interested in trying it out or just want to know more are https://github.com/jborean93/pypsexec and https://www.bloggingforlogging.com/2018/03/12/introducing-psexec-for-python/.
Any feedback is most welcome.
Thanks
Jordan