SSH and PowerShell

brettSo last night I was doing a bit of work, and kept having to switch between PuTTY and PowerShell to accomplish the task. This is a pretty normal procedure however it annoyed me that PowerShell lacks SSH ability natively. I did quite a bit of reading on the topic and decided that installing a bunch of libraries so that I could write a script that allowed for a similar function was just as annoying. That’s when I found an app called Plink which is made by the same fine people who make PuTTY. You can download Plink for free here; http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html . Now to make this useful, I put plink.exe in the same folder as my other PowerShell scripts in c:\ps . Then I made a new script using the Windows PowerShell ISE to make a very basic script that opens Plink.exe with the -ssh switch and the IP of the machine I am making the SSH connection to. This is a copy of that script;

cd c:\ps
& “.\Plink.exe” -ssh IPAdressGoesHere

I saved the script as linux.ps1 and then proceeded to create an alias that runs this script when I enter the alias name “linux”

set-alias linux c:\ps\linux.ps1

Now when I run the command linux, an ssh session opens directly to my vps, at the login prompt.

Leave a Reply