Execute Unix Command From Windows Server

As a system administrator, many times situation comes when you need to execute some Unix command from windows. In most of the cases, you will download a putty, login to the Unix server, and then execute a command.

Now, if you want to run the Unix command from the Windows command prompt then there is some limitation.

So in order to overcome this situation, I developed a tool that you can use in a windows machine 64bit OS and directly execute a command and get output from any Unix server.

The tool was developed in Python and converted into binary using pyinstaller library.

This tool can execute a Unix command directly from the windows command line.

In addition to execution, it can also store the output in a text file for your reference. In a broad sense, any machine which supports ssh and you want to get some output from that machine, read any file content then this tool will be helpful.

I have named this tool as SSH From Windows. SSH from windows tool is completely free and available for download.

You can use this tool from the Windows command prompt and get the output of any Unix command from the device, which supports ssh connectivity.

SSH from windows can execute any command and get the output from the SSH machine and display in Command prompt Screen.

If you want to store the output then use the optional argument “-o” and the tool will store the content in the same folder where the application is running.

Read the post on Python Script To Login Multiple Servers.

How To Use The SSH from Windows:

Step1: Download the zipped File.

Step2: Extract the File to a specified Folder.

Step3: Open Windows Command Prompt.

Step4: Traverse to the folder where this tool is stored.

Step5: Execute the command “ssh -h” to see the syntax.

Step6: Below is the syntex and Unix Command  to get “ifconfig -a” out from a Linux Machine.

ssh <Server_Name> <Username> <Password> <Unix_Command>
ssh host1 storageadmin password “ifconfig -a”

Step7: If want to store the output in a file the use “-o” at the end.

This will generate a .txt file in the same folder with the Unix server name and store the output into it.

ssh host1 storageadmin password “ifconfig -a” -o

Various Scenarios To Use SSH From Windows

  1. Get Unix system logs for multiple servers.
  2. You can get system information without actually logging in to it.
  3. Get the specific system command output quickly.
  4. Quickly read the content of any file hosted on ssh machine e.g. “cat /etc/hosts”.

You can use this tool on many other ways to reduce your day to day effort you just have to be aware of the exact command to execute.

Though this tool can be useful for executing configuration changes command, I strongly recommend to use it only for information collection.

Please share your input on this tool and suggest if any improvement can be done on this.

Leave a Comment