Working with Scripts
 
Working with Scripts
FortiManager scripts enable you to create, execute and view the results of scripts executed on FortiGate devices attached to the FortiManager system. At least one FortiGate device must be configured on the FortiManager system for you to be able to use scripts. Scripts can also be run on the FortiManager global database.
 
Any scripts that are run on the global database must use complete commands. For example, if the full command is config system global, do not use conf sys glob.
Scripts can be written in one of two formats. The first format contains a sequence of FortiGate CLI commands, as you would type them at the command line. A comment line starts with the number sign (#). A comment line will not be executed.
The second format uses TCL scripting commands to provide more functionality to your scripts including global variables and decision structures.
When writing your scripts, it is generally easier to write them in a context-sensitive editor, and then cut and paste them into the script editor on your FortiManager system. This can help avoid syntax errors and can easily reduce the troubleshooting required for your scripts.
This section contains the following topics:
Device view
Script samples
For information about scripting commands, see FortiGate CLI reference.
 
Before using scripts, ensure the console more function has been disabled in the FortiGate CLI. Otherwise scripts and other output longer than a screen in length will not execute or display correctly.