View Single Post
Old 06-04-2019, 11:16 AM
jdev's Avatar
jdev jdev is offline
VanDyke Technical Support
Join Date: Nov 2003
Location: Albuquerque, NM
Posts: 941
Originally Posted by ecox View Post
my problem is:
SecureCRT opens a new session for each device.
Yes. Opening a new session for each device is exactly this example script is designed to do. The script tells SecureCRT to establish a connection (from the machine on which SecureCRT is actually installed and running) to the specified host -- whether that host be:
  • a saved session
  • an ad hoc connection, e.g. using a saved session in SecureCRT using a connect method similar to what Quick Connect does to establish a connection.

Originally Posted by ecox View Post
Why does not he execute the commands on the session I'm on?
It seems like what you want to do is:
  • Use an already-connected session to a remote host (say, is it a "gateway" or "jump host" you're connected to?), then
  • Tell that host to connect to another host (like, run an 'ssh host1' or 'telnet host1' command to get to another host),
  • Once connected to the secondary host from there, run commands on that secondary host, and then
  • "exit" that connection between the primary host and the secondary host and then...
  • Move on to the next secondary host.
Does this list accurately reflect what you want to do?

If not, would you be so kind as to provide more explicit details related to your objective, giving concrete examples?

If it does reflect what you want to accomplish, we simply don't have a complete example for you.

There are bits and pieces, however, which you could put together and use to roll your own solution using this script as your base starting point...
One approach would be:
  1. Modify the base script's Connect() function (it's defined within the script file itself) to run your 'ssh' or 'telnet' command to get to the specified host instead of calling crt.Session.ConnectInTab()
  2. Hint: Use the approach exemplified in this other example script, "Example: Jump Host - Handle Secondary Host Connection Attempts" to handle the secondary host connection and authentication.
  3. Modify the part of the base script which currently tells the tab's Session object to Disconnect() to instead send "exit" & vbcr, and wait for your jump host's shell prompt to appear so that the script knows when it's appropriate to move on to the next host in you hosts file.
Jake Devenport
VanDyke Software
Technical Support
YouTube Channel:
Reply With Quote