View Single Post
Old 08-30-2012, 05:05 PM
rtb rtb is offline
VanDyke Technical Support
Join Date: Aug 2008
Posts: 4,306
Post Example: Read Data From Separate Hosts/Commands File And Log To Individual Files

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):
Last updated: 21 May, 2018 (initial revision)

VBScript Version (for use on Windows versions of SecureCRT):
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.

Attached Files
File Type: txt RunCommandsOnMultipleHostsAndLogResults.vbs.txt (44.4 KB, 7604 views)
File Type: txt (45.9 KB, 4138 views)
File Type: txt ##hosts.txt (1.1 KB, 3791 views)
File Type: txt ##commands.txt (575 Bytes, 3691 views)
File Type: txt ##DeviceType1Commands.txt (396 Bytes, 3147 views)
File Type: txt ##DeviceType2Commands.txt (399 Bytes, 2554 views)

Last edited by jdev; 05-23-2018 at 02:50 PM. Reason: Update VBScript code and post newly-available Python version
Reply With Quote