Create an executable command script in NCM
Several tasks can be automated with command scripts. For example:
- Downloading configuration files
- Uploading configuration files
- Uploading IOS images
- Updating logon banners
- Updating access control lists (ACLs)
With the correct use of variables, a single script can be executed on several different devices, without concern for syntax differences.
Scripts are delivered one line at a time to the target devices.
Create a command script
- Click My Dashboards > Network Configuration > Configuration Management.
- Click the Script Management tab.
- Click Add New Script.
- Add the script information. To include variables or custom properties, see the following sections.
- Click Save.
- To execute the script, on the Config Management tab select one or more nodes and follow the steps to Execute a script on a node.
Use variables in scripts
You can use the following types of variables (also called macros) in command scripts:
With Command variables, you can execute the same script on different types of devices. Command variables substitute the right commands based on the device type. For example, the variable ${EnterConfigMode}
is parsed as config terminal
when the script runs on Cisco IOS devices, but it is parsed as configure
when the script run on an HP Procurve Switch.
See an example variable script.
Use custom properties in scripts
You can use custom properties to specify additional information about a device, such as the device's physical location, support contact information, or role (for example, testing or production).
To include custom properties in a script, enter the custom property name as you would a macro, with a ${
(dollar sign and opening curly bracket) at the beginning and }
(closing curly bracket) at the end. For example, ${City}
or ${Department}
.