Fortinet black logo

Administration Guide

Scripts

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 config system global, do not use conf sys glob.

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 console-output function has been set to standard in the FortiGate CLI. Otherwise, scripts and other output longer than a screen in length will not execute or display correctly.

When pushing a script from the FortiManager to the FortiGate with workspace enabled, you must save the changes in the Policy & Objects tab.

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 config system global, do not use conf sys glob.

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 console-output function has been set to standard in the FortiGate CLI. Otherwise, scripts and other output longer than a screen in length will not execute or display correctly.

When pushing a script from the FortiManager to the FortiGate with workspace enabled, you must save the changes in the Policy & Objects tab.