How to automate PuTTy from Excel?

putty automation using vba
putty command line script
send commands to putty from batch file
how to run commands in putty using batch file
ssh from excel
plink multiple commands
putty macro
plink putty

I have been trying to automate the following sequence of steps in puTTy via VBA from Excel

  1. Login to putty
  2. execute a command
  3. copy the result from putty and paste it in excel.

So far I have written the code for logging into the server by initiating the putty Application.(Refer the code below)

Sub Putty()
  Dim TaskID As Long
  TaskID = Shell("path/putty.exe servername", vbNormalFocus)
  AppActivate TaskID, True
  SendKeys "username"
  SendKeys "{ENTER}"
  SendKeys "password"
  SendKeys "{ENTER}"
  '---- Here i need to execute a command for eg: "ls -l" and copy the result into Excel
End Sub

Can you please give some idea about how to execute a command after this step and to copy the result from PuTTy to Excel?

I would use Plink instead of the main Putty application. Plink is putty designed for the command-line.

Look into shell redirection, answers such as this here.

The basic idea is you can create a WScript.Shell object, run plink.exe using it, then write to StdIn and read from StdOut. StdIn is like typing text into a console window and StdOut is what gets displayed to the user in said console window.

Putty automation using excel vba, Hi, Some one please guide me how to automate putty using vba. I am able to invoke putty.exe using Shell command, but not able to enter the  How to automate PuTTy from Excel? 1. putty automation using selenium webdriver. 3. Automating command/script execution using PuTTY. 0.

You can specify a log file in putty and watch that log file as you go. It's not the best way to do it, but without admin rights it is one way of doing it.

Script to open a SSH session in Putty from Excel? : sysadmin, Hi, sorry if this is the wrong sub to post this in, but I need to know how to make a script to open a SSH session in Putty from Excel. I have a spreadsheet of  How to automate PuTTy from Excel? Login to putty execute a command copy the result from putty and paste it in excel.

It would run better if you add application wait timer in the script, sendkeys is not very reliable function.

Epic way to connect to Linux server from Microsoft Excel., Epic way to connect to Linux server from Microsoft Excel. June 1, 2017 By Please download putty.exe from the below links as per your architecture (32 Bit or 64 Bit). putty.exe (the SSH Write Macro for automating the task. Now we need to  I believe some PuTTY implementations have screen capture controls that will create a file on your PC. Some implementations also allow for file transfers byte for byte.

Running Putty from Excel or Command Line – Collab Work, I had all the IP addresses in Excel, I wanted to make a hyperlink that would launch putty when I click on the link….I never figured out the  A simple how to on the login macro for PuTTY Connection Manager. Windows Script to Automate Synchronize Remote to Local Directory using WinSCP - Duration: Excel Tips 14 - Links in Excel to

SSH Client using VBA - Excel VBA Templates, Example of using simple SSH client for uploading and downloading files based on Excel. It is possible to modify it to ease the automation of tasks on the remote  You have to quote the path to PuTTY, as it contains spaces. Also you execute putty.exe twice. Instead you have to pass all those parameters to a single instance of putty.exe. pc1 = """C:\Program Files (x86)\PuTTY\putty.exe"" " & _ "-ssh " & UserName & "@ip address -pw " & Passwrd & " -m ""C:\Temp\emu.sh""" TaskID = Shell(pc1, 1)

Macro to open Putty and paste contents, Connect to putty through excel macro - the login details should betaken from Can some one help to achieve above by editing the below script You can create a putty session, and auto load the script on the server, when starting the session: putty -load "sessionName" At remote command, point to the remote script.

Comments
  • Does putty have an API that you could reference instead of trying to use SendKeys?
  • Hi @DavidZemens I really dont have any idea about it.
  • Hi @AndASM, thanks for the reply.I have seen the same suggestions previously in other sites, but i have some administrative restrictions on using the plink. So this means is it not possible to do with putty.exe?
  • To a limited extent it can be done with putty.exe, through the methods of doing so are fragile and prone to breaking. Many of the ways you'd do this are likely blocked if you can't run plink.exe. If the connection you are opening is telnet not ssh, I'd open the connection directly from VBA and skip the external program. If it is ssh, reimplementing all the encryption yourself is prohibitive.