PDA

View Full Version : Alternative for sendkey



ganesh_6663
04-10-2019, 11:45 PM
Hi,
Here is my macro but dont want to use sendkey to send command to server , is their any Alternative for sendkey ? or any other option for ssh to sever and send command using vba.

please help.



Sub PUTTYSSH()

cmd1 = "D:\putty\putty.exe 195.144.107.198 -l demo -pw password "


Application.DisplayAlerts = True
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run (cmd1)




Application.Wait Now + TimeValue("00:00:01")
WshShell.SendKeys "whoami{ENTER}"
Application.Wait Now + TimeValue("00:00:01")
WshShell.SendKeys "help{ENTER}"
WshShell.SendKeys "{ENTER}"




End Sub