0

I am trying to set up SSH connections in PowerShell to replace PuTTY. I am able to open PowerShell and connect using the command ssh mrpeanut@myserver.com -i .ssh\mrpeanut. However, I was hoping to save that as a connection like I can do in PuTTY so that I can right-click PowerShell and immediately open that connection. Is there a way to do that with PowerShell?

Functionality I'm trying to replicate from PuTTY:

PuTTY saved connections

  • not sure if relevant but maybe a power-shell script with the steps required for log-in..I know it wouldn't be complete with a GUI like putty but I don't think you could really achieve this without the use of GUI that would display your saved connections. Maybe write the script for each log-in case and put them all together in a scripts folder. hope this helps! – RickwhoPrograms Oct 15 '18 at 18:59
1

Simply create a text file on your Desktop using extension .ps1 and put your connection string into it. After that you can right click on it and select Run with PowerShell to run the script and start the connection.

Don't forget that you cannot use the Putty key format with OpenSSH. You have to convert your private key to OpenSSH format using puttygen.

  • That gets me pretty close to what I'm looking for. I have PowerShell pinned to my taskbar. Is there a way to right-click the icon and access that .ps1 file via the jump list? – MrPeanut Oct 15 '18 at 19:39
  • Just drag and drop the ps1 file to the Powershell icon to add it to the jump list. – bcs78 Oct 15 '18 at 19:45
  • It just opens PowerShell then immediately closes it. – MrPeanut Oct 15 '18 at 19:59
  • Because there's an error during connection. Add a pause command to the end of your script to see the error message. Don't forget that you cannot use the Putty key format with OpenSSH. You have to convert your private key to OpenSSH format using puttygen. – bcs78 Oct 15 '18 at 20:16
  • 1
    I had to use Set-ExecutionPolicy RemoteSigned to allow my own scripts. That seems to work. Thanks! – MrPeanut Oct 15 '18 at 23:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.