Run PowerShell through SSH

I’m testing some Linux stuff, and found myself wanting to see if I could easily connect to a PowerShell session on my Windows boxes from a SSH client. It turns out it’s a lot easier than first anticipated!

First, I went and had a look at CygWin, which includes an openSSH server, but that didn’t get me anywhere. The results of any PowerShell commands simply weren’t returned, and tab-completion didn’t work either.

Then I came across this article (http://www.windowsnetworking.com/articles_tutorials/install-ssh-server-windows-server-2008.html) and that did everything I needed. FreeSSHd (the install is documented in the link above) supports domain user authentication and it also seems a lot faster than cygwin.

A neat trick I found was to replace the standard cmd command shell with PowerShell, like this:


This starts a PowerShell session everytime you log into the SSH session, and it works great!

 

PSRemoting from this session to other computers also works nicely.

Sweet! I have PowerShell through SSH, and it’s May 17th!

7 thoughts on “Run PowerShell through SSH

  1. Hm. I gave it a try (admittedly with Windows 7 Enterprise 64-bit in a VM, so a fair bit different to your setup) and I just get cut off. The FreeSSH log says login was successful. If I try the old console model, I get a couple of lines of text from powershell.exe , but no response. Using putty (from MacPorts) gets the same result. I’ll try using cmd.exe when I have a bit of time later.

Leave a Reply