Running linux commands into linux system remotely using powershell

DevSupport used Ask the Experts™
Hi Experts,

I was looking for the best way to run linux shell commands in linux system from a windows system remotely using powershell and batch.

Please let me know the best way to do it.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
John TsioumprisSoftware & Systems Engineer

Usually the way to run commands to remote Linux system is via Putty...if my memory serves me right i never saw running commands for Linux via powershell


can we use new-sshsession to connect to linux system and execute shell commands?


Microsoft thoughtfully added SSH support into PowerShell so you can SSH to the linux box and even script it.
More details can be found here.
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Natty GregIn Theory (IT)

Putty or winscp
Top Expert 2014
To be fair, MS hasn't added support for SSH to PowerShell yet.  They're working on it, and it is possible via an SSH module (which is not created by MS) as in the link provided by Colin_UK.  That module does allow you to run commands on a remote Linux machine via SSH in PowerShell.  I'm assuming you want to run commands from a console interface or script (i.e. without relying on a GUI).

One way to do so in batch files is through the use of Plink (essentially a command line version of Putty).
Gerwin Jansen, EE MVETopic Advisor
Most Valuable Expert 2016

Already answered, but if you have Windows 10 then Bash on Windows may be an option for you:

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial