|
![]() |
|
Thread Tools | Rate Thread | Display Modes |
#1
|
|||
|
|||
![]()
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/Windows versions of SecureCRT): 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. . Last edited by jdev; 02-02-2022 at 03:27 PM. Reason: Explain that VBScript version is no longer being updated/maintained. |
#2
|
|||
|
|||
help!
Todd:
Also, is there is a way to stop the output from pausing? For instace, if the command output is too long, it will not complte the log file unless I manually press the enter key until the output is completed. Thank you |
#3
|
|||
|
|||
help!
Also,
The first host execute the command, but on the second host, I get the following error: CRT Scripting Runtime error Error: Sreen.CurrentRow: not connected Line 186 which points to the following line of code: nRow = crt.Screen.CurrentRow ![]() |
#4
|
||||
|
||||
Quote:
Quote:
To create a raw log:
__________________
Mike VanDyke Software Technical Support [http://www.vandyke.com/support] |
#5
|
|||
|
|||
I follow your instructions, but the log is empty. I can clearly see that secrteCRT connects to the second host, but it doesnt issue a command, and then I get the error...
Quote:
|
#6
|
|||
|
|||
Is there a python version of this example? Thanks!
|
#7
|
|||
|
|||
Hi joeboy,
Thanks for the question. I have one in the works, but it is not yet complete. I will post here when it is. |
#8
|
||||
|
||||
I second the req for a python version. Well done RTB!
|
#9
|
|||
|
|||
Hi Elder,
Todd (RTB) is not available. I will make sure he knows you "second the motion". ![]()
__________________
Thanks, --Brenda VanDyke Software Technical Support support@vandyke.com (505) 332-5730 |
#10
|
|||
|
|||
Hi All,
I have finally finished my Python port of the VBScript version of this script. Have at it. Last edited by rtb; 06-05-2013 at 03:00 PM. |
#11
|
|||
|
|||
Is the Python program will work for Windows 7 too?
|
#12
|
|||
|
|||
Hi quinj,
Yes, SecureCRT is capable of hosting "ActiveX Script" engines. Python scripts can be run in SecureCRT/Windows.
__________________
Thanks, --Brenda VanDyke Software Technical Support support@vandyke.com (505) 332-5730 |
#13
|
|||
|
|||
I apologize, the python program on this thread can be used in Windows 7. Looking at it inside, it all shows Windows XP.
Thanks quinj |
#14
|
|||
|
|||
Hi, I'm using this excellent script. I have a noob question - as it is the script saves the configuration files using the IP address in the filename, I am using fqdn's to connect to the devices, so am curious how one would modify it so that the file name reflects what was passed to the script in the hosts.txt file instead of the IP. There may be cases where I use an IP, but if I use an fqdn, I'd prefer the output file to use it as well.
|
#15
|
|||
|
|||
Hi hvh2000,
Thanks for the post. It seems like you are using the VBScript version. If I am wrong, please correct me because the log file code is different between the VBScript and Python versions. In the VBScript code starting on line 257, the IPADDRESS portion of the template name gets replaced with the IP address (g_objNewTab.Session.RemoteAddress). Line 260 could be modified to use g_strhost which is obtained on line 136 from the host file. Does this help you accomplish your goal? |
![]() |
Tags |
example script |
Thread Tools | |
Display Modes | Rate This Thread |
|
|