View Single Post
  #137  
Old 10-25-2018, 05:31 PM
Dagrin Dagrin is offline
Registered User
 
Join Date: Oct 2018
Posts: 1
Question Issues Executing Script - Separate Hosts/Commands File and Log to Individual Files

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.



.
I downloaded the example script mentioned above and I am able to have it execute the host list. I am using the script to connect to multiple Cisco routers and need it to enter configuration mode. The commands.txt file executes the first few lines as expected, but after executing "configure" the script hangs. I suspect that it is hanging because the prompt changes from # to (config)#. I cannot find the location in the script that forces the script to only continue after seeing the prompt of # to return. I need to change that to allow the continuance if the changed prompt occurs. Any advice?
Reply With Quote