2

I am using SecureCRT and want to run a vbs script while I am connected in a session, I want to get a site name from user by prompt and then use this variable inside a specific command (pmxh is a session specific command) to send this command to the session, here is my code but I don't know why my echo is not working and returning error (i just want to send pmxh command to the terminal that I have an already open session in it)

Sub Main()
' Prompt the end user for data
strAnswer = InputBox("Please enter site Name:")
' Check to see if the user provided any data, or canceled.
If strAnswer = "" Then
MsgBox "Canceled."
Exit Sub
End If
wscript.echo("pmxh strAnswer -m 0.25 -a pmTotNoRrcConnectReq")
End Sub
solarisan
  • 67
  • 7

1 Answers1

1

I believe you are looking for the crt.Screen.Send command.

crt.Screen.Synchronous = True
' This automatically generated script may need to be
' edited in order to work correctly.
Sub Main()
  crt.Screen.Send "cd vshell" & chr(9) & chr(13)
  crt.Screen.WaitForString "$ "
  crt.Screen.Send "ls" & chr(13)
  crt.Screen.WaitForString "$ "
  crt.Screen.Send "rpm -U vshell-3.5.0-3" & chr(9) & chr(13)
  crt.Screen.WaitForString "$ "
  crt.Screen.Send "telnet localhost 22" & chr(13)
  crt.Screen.Send chr(13)
End Sub

Read more on sending commands to the terminal -> here (page 10)

user692942
  • 16,398
  • 7
  • 76
  • 175
Rich
  • 4,134
  • 3
  • 26
  • 45