Scripts
FortiManager scripts enable you to create, execute, and view the results of scripts executed on FortiGate devices, policy packages, the ADOM database, the global policy package, or the device database. Scripts can also be filtered based on different device information, such as OS type and platform.
At least one FortiGate device must be configured in the FortiManager system before you can use scripts.
Additional configuration options and short-cuts are available using the right-click menu. Right-click the mouse on different navigation panes in the GUI page to access these options. |
Any scripts that are run on the global database must use complete commands. For example, if the full command is |
Scripts can be written in one of two formats:
- 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.
- 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 reduce the amount of troubleshooting required for your scripts.
CLI scripts can be grouped together, allowing multiple scripts to be run on a target at the same time. See CLI script group for information.
Go to Device Manager > Scripts to view the Script and Script Group entries.
For information about scripting commands, see the FortiGate CLI reference.
Before using scripts, ensure the |
When pushing a script from the FortiManager to the FortiGate with workspace enabled, you must save the changes in the Policy & Objects tab. |
After running a script with configuration changes directly on a FortiGate, you can import the configuration from the FortiGate to FortiManager in order to bring the script's changes into the FortiManager database. |