ABX action to OpenSSH to a Windows Server

Recently I needed to create a connection to a Windows server and perform some operations on it. From there I wanted to run commands on the Windows server itself, and I didnt want to have to worry about double hop WinRM issues from PowerShell. I wanted something flexible that I could use as a template moving forwards. After a fair bit of fiddling I finally got it to work and even better, I didnt need vRO, it could all be completed from an extensibility action written in Python. Below is the code demonstrating the execution of a simple Windows command, ipconfig. If you were using this in production, you would obviously use Action Constants to keep the username, password and IP details secure, admitted here to make it easier for you to follow. In addition, you may want to look into using an SSH key and amending the set_missing_host_key_policy method.

Note that the code has a dependency on a Python library, called paramiko. You will need to enter specify this dependency to obtain the library and have it injected into the ABX container at runtime

More information can be found on my blog.

Sign in to be able to add comments.

Comments 0