VanDyke Software

Scripting Examples


Run Commands on Multiple Hosts and Log Results

(AKA: 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.

Example Script

Python Example (for use on macOS/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.

VanDyke Software uses cookies to give you the best online experience. Before continuing to use this site, please confirm that you agree to our use of cookies. Please see our Cookie Usage for details.