I have been working on a script, part of which will use plink (command line version of putty, used for making ssh connections)
to connect to a remote server run a command and return the result to a text area within the HTA.
This works fine if i have connected to the server before, but if i havent it will hang because it is not getting a response to the y/n question of storing the host keys.
To get around this i thought i could open a cmd prompt and run plink from there, thus giving me sort of an interactive session, so that if they key was known, the user would not be prompted, but if the host key was not know, the dos box would show the message about accepting the host key, and once you type yes or no the command that you passed to plink via the command line is executed.
(at first i thought i would use putty, but it does not allow you to pass a comaand as a commandline variable like plink does)
The issue i have is that when the script runs plink, the dos box pops up but then it hangs there, and my textarea is populated with
C:\Documents and Settings\%USERNAME%\Desktop\test\VB work\VBS work\VBS text>
Which is just the local path of my HTA.
The command works fine when i use it manually with the command line.
Can anyone see whats going wrong?
tilltext.Value = "Checking Connection Status..."
connect = "0"
If connect = "1" then
tilltext.Value = "Running Command"
Set objShell1 = CreateObject("WScript.Shell")
Set objWshScriptExec1 = objShell1.exec("cmd /K " & Chr(34) & "C:\Program Files\Putty\plink" & Chr(34) & " -ssh" & strdata2 & " -l MYUSER -pw MYPASS " & strplinkcmd)
Set objStdOut1 = objWshScriptExec1.StdOut
strOutput1 = objStdOut1.ReadAll
TillText.value = strOutput1
strdata2 = a variable that hold machine name
strplinkcmd = a linux command
Thanks in advance