Working with Scripts : Script view : Creating or editing a script
 
Creating or editing a script
From the Device Manager script screen, you can create a new script or edit an existing script.
Figure 155: Create or edit a script
To create or edit a script:
1. Go to Device Manager > Tools > Script and select either CLI Script or TCL Script.
2. Select either Create New or select the Edit icon for the script to edit.
3. If you are creating a script, enter a short descriptive name for this script. The name should be unique and easy to recognize. If you are editing an existing script, the script name is read-only.
For tips and examples on how to write scripts, select the View Sample Script link to open a small online help window that contains various script examples.
4. Enter a description of what action(s) the script performs. As with the script name, keep the description short and useful.
5. Enter your script in the Script Detail field by:
entering the commands manually (for CLI or TCL scripts)
cutting and pasting from a FortiGate unit CLI (for CLI scripts)
cutting and pasting from an editor of your choice (for CLI or TCL scripts)
For information on writing CLI or TCL scripts, see “Script samples”.
 
When creating a script, use full command syntax instead of abbreviations.
 
For longer TCL scripts, a context sensitive editor is recommended to reduce errors.
 
TCL scripts cannot include the TCL exit command.
6. Optionally you can add information to limit what devices can run the script. This includes selecting the OS Type, OS Version, platform, firmware build, device name, hostname of the device, and serial number.
7. Select OK to save your new script and return to the Script Repository.
After creating or editing a script, you can test it using the script procedure in “Scheduling a script”. If your script does not execute properly, see “Script samples” for troubleshooting tips.