Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 02-18-2021, 01:46 PM
SeanL SeanL is offline
Registered User
 
Join Date: Nov 2020
Posts: 2
Launch New Sessions from host list

Looking for a script or built in function that lets me launch a large number of sessions (10-100) at once. Ideally it would just use the same default session settings.

With the upgrade 9.0 today allowing python 3 i'm wondering if anyone has any ideas?

I've been using one for a while but it's a bit annoying to setup:
Code:
# $language = "python"
# $interface = "1.0"

# Connect to an SSH server using the SSH2 protocol. Specify the
# username and password and hostname on the command line as well as
# some SSH2 protocol specific options.


def main():
	crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 4494R")
	crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 4495R")
	crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 4499R")
	crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 6401R")
	crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 6402R")
	crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 6403R")
	crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 6404R")
	crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 6405R")
	crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 6406R")
	crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 6408R")
	crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 6409R")
	crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 6411R")
	crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 6413R")
	crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 6416R")
	crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 1534R")
	crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 1546R")
	crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 1570R")
	crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 1586R")
	crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 1608R")
	crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 1638R")
	crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 6439R")


		
main()

Ideally I'd like to be able to QUICKLY loop through a list of hostnames and launch a session for it.
Right now my script has to be manually edited with the new hostnames or IPs and it only starts launching the next session after about 3-5 seconds since launching the last one.


In the end I'll use the command window to send the same set of commands to all devices.

Any ideas would be much appreciated, thank you!
Reply With Quote
  #2  
Old 02-18-2021, 02:43 PM
berdmann berdmann is offline
VanDyke Technical Support
 
Join Date: Aug 2017
Posts: 441
Hi SeanL,

We have a script code example that shows how to instruct SecureCRT to establish ad-hoc connections to hosts listed one by one in the clipboard that I think might provide you with the functionality that you are looking for.

Please refer to the following link:
https://forums.vandyke.com/showpost....86&postcount=1
Does that seem like something that might work well for you?
__________________
Thanks,
--Brittney

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


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 09:12 AM.