Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Reply
 
Thread Tools Rate Thread Display Modes
  #121  
Old 12-21-2017, 09:44 AM
ekoranyi ekoranyi is offline
VanDyke Technical Support
 
Join Date: Jan 2017
Posts: 654
Hi karthia,

Can you download a "fresh" version of this script from here, run the script, and provide a log file that the script generates and that displays the issue you are seeing?

PLEASE DO NOT POST THE LOGS TO THE FORUMS.


Please send the log file to Support@VanDyke.com with "Attn: Eric Forum Post 10651" in the subject line.
__________________
Thanks,
--Eric

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #122  
Old 08-02-2018, 02:28 AM
feltaz feltaz is offline
Registered User
 
Join Date: Aug 2018
Posts: 1
script stop after 1 device

Hi, I was trying to use the script below as it actually fit my need which basically SSH to multiple host and store all capture command in 1 file.

But upon running it, the command stop after first device with no error prompt just basically stop while the session still connecting to the first devices

Question:

how does the iteration done in the script ? and what trigger to go to news host device ?

Thanks before



Quote:
Originally Posted by rtb View Post
Demonstrates how to connect to hosts read in from a "hosts" file and for each host, send a list of commands read in from a "commands" file. Results of each command run are (by default) logged to separate, uniquely-named files based on the host address and the command that is run. However, the script code is architected to allow you to change this behavior so that it's all logged to one file per host, or even just to a single file.

Download the example scripts:
Python Version (for use on Mac/Linux versions of SecureCRT):
RunCommandsOnMultipleHostsAndLogResults.py.txt
Last updated: 21 May, 2018 (initial revision)

VBScript Version (for use on Windows versions of SecureCRT):
RunCommandsOnMultipleHostsAndLogResults.vbs.txt
Last updated: 21 May, 2018

Example ##hosts.txt and ##commands.txt files:
The following show you the format of what the ##hosts.txt and ##commands.txt files would look like.The ##hosts.txt file can contain host-specific command file directives, which is what the ##DeviceType1Commands.txt and ##DeviceType2Commands.txt files exemplify.



.
Reply With Quote
  #123  
Old 08-02-2018, 07:48 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,285
Hi feltaz,

What version of SecureCRT are you using?

Which version of the script are you using? (Python or VBScript)

Is Cancel available from the Script menu when the script appears hung? If so, what's the error when you choose Cancel?
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #124  
Old 08-13-2018, 08:43 AM
mibrandt mibrandt is offline
Registered User
 
Join Date: Feb 2012
Posts: 1
Smile RunCommandsOnMultipleHostsAndLogResults using Multiple Logins

Hi, I'm running SecureCRT 8.1.4 and using the RunCommandsOnMultipleHostsAndLogResults.vbs Script. The Script works great, but want to take it to the next level for my needs. I have multiple hosts in my environment and have the need for the script to try logging into a host and if the login fails attempt the next login/password combination. Currently the script only uses one login/password combo? My second request is most of my environment is using SSH2, but I have some hosts still on Telnet, is there a way to have the script attempt SSH2 and if that fails try Telnet?

Great Script have been using it for years, but our Network Infrastructure keeps getting more complicated as we continue to bring on new sites and equipment.

Thanks in Advance.
Reply With Quote
  #125  
Old 08-13-2018, 12:46 PM
ekoranyi ekoranyi is offline
VanDyke Technical Support
 
Join Date: Jan 2017
Posts: 654
Hi mibrandt,

We don't currently have any example scripts that demonstrate this functionality. You will most likely want to take advantage of the Connected property of the Session object.

Description
Returns a Boolean value indicating whether the current session is connected or not.
This would allow you to test after each connection attempt to see if it is successful.

You will likely also need to take advantage of the ConnectInTab methods additional parameters.

The ConnectInTab method takes two optional parameters (True or False). The first determines whether or not the script should wait for the connection to fully authenticate before continuing. The first parameter only applies to SSH1 and SSH2 connections. The second optional parameter specifies whether the call fails silently or raises an exception. If the second parameter is False and the connection attempt fails, an exception is raised and the method returns an empty object. If the second parameter is True and the connection attempt fails, the method returns a valid Tab object, which can then be used to check for connection status in order to determine if the connection attempt was successful.
__________________
Thanks,
--Eric

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #126  
Old 08-28-2018, 01:32 PM
karthia karthia is offline
Registered User
 
Join Date: Dec 2017
Posts: 3
Script is not running

Quote:
Originally Posted by rtb View Post
Demonstrates how to connect to hosts read in from a "hosts" file and for each host, send a list of commands read in from a "commands" file. Results of each command run are (by default) logged to separate, uniquely-named files based on the host address and the command that is run. However, the script code is architected to allow you to change this behavior so that it's all logged to one file per host, or even just to a single file.

Download the example scripts:
Python Version (for use on Mac/Linux versions of SecureCRT):
RunCommandsOnMultipleHostsAndLogResults.py.txt
Last updated: 21 May, 2018 (initial revision)

VBScript Version (for use on Windows versions of SecureCRT):
RunCommandsOnMultipleHostsAndLogResults.vbs.txt
Last updated: 21 May, 2018

Example ##hosts.txt and ##commands.txt files:
The following show you the format of what the ##hosts.txt and ##commands.txt files would look like.The ##hosts.txt file can contain host-specific command file directives, which is what the ##DeviceType1Commands.txt and ##DeviceType2Commands.txt files exemplify.



.
Script stops at line 384
Reply With Quote
  #127  
Old 08-28-2018, 01:40 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,285
Hi Karthia,

Which script did you use? The Python version or the VBScript version?

What is the exact error you get? Please post a screenshot.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #128  
Old 09-05-2018, 05:11 AM
luschwe luschwe is offline
Registered User
 
Join Date: Sep 2018
Posts: 4
Question VB Script instead of commands

Hello,

because of some interactive commands (yes/no ... ) on Brocade Switches i want to use a external VB Script instead of the ##commands file. Is there a way to call a external VBS in combination with the host.txt file.


Cheers, luschwe
Reply With Quote
  #129  
Old 09-05-2018, 09:01 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,285
Hi luschwe,

I am also confused.

You want the RunCommandsOnMultipleHostsAndLogResults script to call another script?

Please post in detail what you are trying to accomplish.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #130  
Old 09-05-2018, 10:57 AM
luschwe luschwe is offline
Registered User
 
Join Date: Sep 2018
Posts: 4
Hi bgagnon - do not be confused

i want to configure DNS entriss on multiple Brocade SAN Switches listed in the host.txt

By using the command “dnsconfig”, you‘ll get a 4-item menue:


Enter option
1 Display Domain Name Service (DNS) configuration
2 Set DNS configuration
3 Remove DNS configuration
4 Quit
Select an item: (1..4) [4]

to add 2 DNS servers, we have choose option 2:
Enter Domain Name: [] xxxxx.net
Enter Name Server IP address in dot/colon notation: [] xxx.xxx.xxx.xxx
Enter Name Server IP address in dot/colon notation: [] yyy.yyyy.yyyy.yyyy
DNS parameters saved successfully

I would like to record this with the Script recorder and then implement this in the mentioned script
Reply With Quote
  #131  
Old 09-05-2018, 12:00 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,285
Hi luschwe,

What version of SecureCRT are you using?

Are you familiar with the Command window?

If this is something that you only need once (or a few times) it would seem your task would be much better suited to using the Command window than bothering with editing scripts.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #132  
Old 09-05-2018, 12:23 PM
luschwe luschwe is offline
Registered User
 
Join Date: Sep 2018
Posts: 4
Thanks for fast Update. Yes, we use the Command window already for other commands. But this is not usefull for this.
Please note that DNS command was only an easy example for our demands

We are using latest version of SecureCRT ... now 8.5

I read between the lines that a interactive Script is not easy to implement .. ?
Reply With Quote
  #133  
Old 09-05-2018, 01:42 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,285
Hi luschwe,

It certainly won't be easy, but rather than try to make use of two different scripts, you could just incorporate what you get when you record into the existing script, I would think.

Are there going to be other commands you need to run?

What I mean by that is to any one device is there going to be command after command where you will need to interact in this manner?
__________________
Thanks,
--Brenda

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

Last edited by bgagnon; 09-05-2018 at 01:53 PM. Reason: Added clarifying inquiry
Reply With Quote
  #134  
Old 09-05-2018, 02:00 PM
luschwe luschwe is offline
Registered User
 
Join Date: Sep 2018
Posts: 4
Brenda thanks for your answer...

Because the Script Recording within ohne switch could be very helpful in case to rollout this to our whole enveriment of about 160 switches.
Currently i just check the solutions we could use. As i now understand, we can not call a Second recorded script out of your Script here.

Regards, Lutz
Reply With Quote
  #135  
Old 10-04-2018, 10:28 PM
JYOTIRANJAN JYOTIRANJAN is offline
Registered User
 
Join Date: Oct 2018
Posts: 1
Connect Multiple Network elements using Python/VB scripts using SecureCRT

Quote:
Originally Posted by rtb View Post
Demonstrates how to connect to hosts read in from a "hosts" file and for each host, send a list of commands read in from a "commands" file. Results of each command run are (by default) logged to separate, uniquely-named files based on the host address and the command that is run. However, the script code is architected to allow you to change this behavior so that it's all logged to one file per host, or even just to a single file.

Download the example scripts:
Python Version (for use on Mac/Linux versions of SecureCRT):
RunCommandsOnMultipleHostsAndLogResults.py.txt
Last updated: 21 May, 2018 (initial revision)

VBScript Version (for use on Windows versions of SecureCRT):
RunCommandsOnMultipleHostsAndLogResults.vbs.txt
Last updated: 21 May, 2018

Example ##hosts.txt and ##commands.txt files:
The following show you the format of what the ##hosts.txt and ##commands.txt files would look like.The ##hosts.txt file can contain host-specific command file directives, which is what the ##DeviceType1Commands.txt and ##DeviceType2Commands.txt files exemplify.



.
Hi,

I want to login multiple Network element with their IP, then type command 'lt all' then it will ask to give username and password and then again i will continue with other commands. Can you please guide me how to do all those by using Python/VB scripts with SecureCRT.
Reply With Quote
Reply

Tags
example script


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 08:41 PM.