I am trying to automate an ssh session by starting a putty session using plink.exe from a VBA macro. Part of the automation is sending some commands to a linux server. After I run the macro; plink opens in a blank command prompt window but closes a few seconds later . This is the line that attempts to run plink.exe
Set oExec = WshShell.exec("plink.exe -load aaTest")
. I suspected originally that it might be improper string formatting. However, when I try to run the putty gui from the same macro by replacing the above line with
Set oExec = WshShell.exec("putty.exe -load aaTest")
, the putty gui opens and I can login. The StdIn.Write code doesn't work and that is because putty doesn't use StdIn. But I don't get why plink isn't working. What am I doing wrong here?

Here is the complete macro:

Sub AutoMop()
' AutoMop Macro
Set WshShell = VBA.CreateObject("WScript.Shell")
WshShell.CurrentDirectory = ("C:\Users\lxp\Core\91CS\PuTTY")
Set oExec = WshShell.exec("plink.exe -load aaTest")

' Write to the input stream
oExec.StdIn.Write "service ssh status" & vbCrLf
'Application.Wait (Now + TimeValue("0:00:00:05"))
oExec.StdIn.Write "sudo service ssh restart" & vbCrLf

End Sub