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!

  • http://www.sebsgarage.com Sebastian

    Thanks! Just the ticket. I’m off to check out FreeSSHd.

  • Pingback: Changes in Sept 20th 2012 Version | Proxy32()

  • Ivan Garcia

    Eres la onda, gracias

  • http://sergeybelous.com/ Sergey
  • me

    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.

  • http://kireevco.wordpress.com kireevco

    Doesn’t FreeSSH has bypass vulnerability in versions through 1.2.6? http://www.cvedetails.com/vulnerability-list/vendor_id-4506/Freesshd.html

    • https://plus.google.com/105312594725982507259 Charlie Skog

      NO FUN ALLOWED!

  • Markos

    Thanks. Now if only I could find a text editor that I can run through ssh on the remote machine to edit remote files.

    • noone

      nano… vi… vim.. pico…

      • Markos

        Thanks for the tip! Nano is just fine.