Submit a ticketCall us

Training ClassSign up for Network Performance Monitor (NPM) and Scalability instructor-led classes

Attend our instructor-led classes, provided by SolarWinds® Academy, to discuss the more advanced monitoring mechanisms available in NPM as well as how to tune your equipment to optimize its polling capabilities. NPM classes offered:
NPM Custom Monitoring and Polling
Orion Platform Scalability

Reserve your seat.

Home > Success Center > Kiwi CatTools > Kiwi CatTools Documentation > Kiwi CatTools 3.11 Administrator Guide > Activities > Activities list > Device.CLI.Send commands > Running External Scripts

Running External Scripts

Table of contents
No headers
Created by Caroline Juszczak, last modified by Caroline Juszczak on Jun 28, 2016

Views: 269 Votes: 0 Revisions: 1




It is possible to run an external VB script from within the Device.CLI.Send commands activity and use the return value from the external script as part of a CLI command to be executed.


When creating external scripts for use within CatTools, you will need to edit the script files using a script editor.


A number of useful Functions and Variables are exposed for use by external scripts.


Supported Device Scripts





To run an external script from within the Device.CLI.Send commands activity a command should be entered in the following format:





Is the full path to the script to be run.

It must be wrapped in quotes as shown.



Is a string containing values to pass to the external script.

It must be wrapped in quotes as shown.

It cannot contain any quotes.

It is optional as the script may not require variables.

If you need to pass more than one variable to the script then it is up to you how you achieve this within the confines of the variable string. For example you could pass "255|127|1|2" as your variable string and then use the external script to parse these into their individual number values.


Only one %ctRunExternalScript command can exist per line.


The External Script


The external script must have a function Main which is the scripts entry point.

Function Main must accept a string parameter. eg. Function Main(VariableString)

The script must always return a value even if it is a nul value.

The script may need to parse VariableString to seperate it into individual variables for use within the script.

The script has these Functions and Variables exposed to it.

The script can store values for use later using the functionality exposed by a scripting dictionary.


Example Usage:


1. In the below example a script is run which deletes all files from the TFTP folder before the running config is copied into it. The external script doesn't require any parameters and returns a nul value, after which the next command, copy running tftp is executed.



copy running tftp



2. In the below example a script is run which returns a value of the ports to enable based on the value of the StringVariable sent. The variable is 5 in this case, which could, for example, represent the slot number.


Set Port %ctRunExternalScript("C:\PortToEnable.txt","5") enable


So after execution of the script, the command which would actually be processed by the Device.CLI.Send commands activity in CatTools may be,


Set Port 5/1-12 enable


Where the writing in red is the returned value from the function, which is then inserted into the final command used.


3. In this example the hostname is changed to a new hostname. (No variables are passed )


Conf term

hostname %ctRunExternalScript("C:\hostnames.txt")

wri mem


Example External Scripts


(see example 2 above)

In the example below the function returns a value based on that of the input string.


Function Main(inputString)

Dim SelectionValue

SelectionValue = Val(inputString)

Main = ""

Select Case SelectionValue

Case 1

Main = "1/1-12"

Case 2

Main = "2/1-12"

Case 5

Main = "5/1-12"

End Select

End Function


(see example 3 above)

In this example, although the user is not passing an input string, CatTools will pass a default nul string so the 'inputString' variable is still required ??in the function definition.


The function itself is referencing cl.DeviceHostnameId which is one of the variables made available to external scripts.


Function Main(inputString)


If cl.DeviceHostnameId="MyRouter1" Then Main="MyNewRouterName1"

If cl.DeviceHostnameId="MyRouter2" Then Main="MyNewRouterName2"

End Function

Last modified