Executing Bash scripts within/from Powershell

Sometimes you have processes which use multiple systems and if you are real lucky they cover multiple OS flavors, in this case I had a process which needs to make changes on Windows and Linux servers. Since Powershell was relatively new to me, I thought why not start with that. The Windows part was easily covered, but the Linux part, well euhm, takes a bit more effort.

Unfortunately it is not possible (at least I don’t know how) to execute commands directly from Powershell within the Linux servers, so we had to create a workaround.

It is easy to do this with the help of “plink”, plink is a backend tool for Putty and makes it possible to run SSH commands on a command line bases. Now we have tool which can execute commands through SSH within a Linux machine, it is relatively easy 🙂 See the example below.

The bash script (helloworld.sh) which we want to execute:

The Powershell script (testbash.ps1) which executes the bash script:

The result 🙂


Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

One Reply to “Executing Bash scripts within/from Powershell”

Leave a Reply

Your email address will not be published. Required fields are marked *