View Single Post
  #2  
Old 10-09-2018, 10:22 AM
ekoranyi ekoranyi is offline
VanDyke Technical Support
 
Join Date: Jan 2017
Posts: 654
Hi shea_nb,

It sounds like an interesting problem you're trying to solve. I cam imagine several ways to tackle this one. Can you tell me a little more about your use case? It looks like you're using ad-hoc connections rather than saving a session for each host you're connecting to, is there a reason you're not saving sessions? Is there a reason you're launching from the command line rather than from inside SecureCRT?

It does appear that you have a session saved for your jump box named my_jumpbox. One option would be to configure this session to use a logon script. The script would read in a hostname argument and use it to build the appropriate command to send to the jump box. This script might look something like:

Code:
# $language = "VBScript"
# $interface = "1.0"

If crt.Arguments.Count > 0 Then
    strHostname = crt.Arguments(0)
Else
    crt.Dialog.MessageBox "No Hostname Provided"
End If

'Wait for the prompt to appear
crt.Screen.WaitforString "my_jumpbox$"
'Send the command to connect to host
crt.Screen.Send("ym " & strHostname & vbcr)
This would be configured by right clicking on the my_jumpbox session and choosing Properties. In the Session Options window select the Logon Actions category. Enable the Logon Script option and provide the path to the script file.

This would allow you to launch SecureCRT from the command line using:

Code:
SecureCRT.exe /T /Arg hostname1 /S my_jumpbox
This would connect to the jumb box sessions, the logon script would read the argument and send the appropriate "ym hostname1" command. To make this process even easier I might consider creating a batch file that handles most of it for me.

Code:
set HostARG=%1
"c:\Program Files\VanDyke Software\Clients\SecureCRT.exe" /T /ARG %HostARG% /s my_jumpbox
I would name this batch file something like connect.bat and save it in a location that is in the Windows path. This would make it very easy to connect to your sessions, simply type "connect hostname1" at your prompt. You wouldn't even need to modify your batch files nightly.

Does this help get you the behavior you're looking for?
__________________
Thanks,
--Eric

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote