Fortinet white logo
Fortinet white logo

Cookbook

Configuration scripts

Configuration scripts

Configuration scripts are text files that contain CLI command sequences. They can be created using a text editor or copied from a CLI console, either manually or using the Record CLI Script function.

Scripts can be used to run the same task on multiple devices. For example, if your devices use the same security policies, you can enter or record the commands to create those policies in a script, and then run the script on each device. You could also create the policies in the GUI, and then copy and paste the CLI commands from the CLI Console using the show command.

If the FortiGate is managed by FortiManager, scripts can be uploaded to FortiManager and then run on any other FortiGates that are managed by that FortiManager. See Scripts in the FortiManager Administration Guide.

Tooltip

A comment line in a script starts with the number sign (#). Comments are not executed.

To run a script using the GUI:
  1. Click on your username and select Configuration > Scripts.
  2. Click Run Script.
  3. Select the text file containing the script on your management computer, then click OK.

    The script runs immediately, and the Script Execution History table is updated, showing if the script ran successfully.

Configuration scripts

Configuration scripts

Configuration scripts are text files that contain CLI command sequences. They can be created using a text editor or copied from a CLI console, either manually or using the Record CLI Script function.

Scripts can be used to run the same task on multiple devices. For example, if your devices use the same security policies, you can enter or record the commands to create those policies in a script, and then run the script on each device. You could also create the policies in the GUI, and then copy and paste the CLI commands from the CLI Console using the show command.

If the FortiGate is managed by FortiManager, scripts can be uploaded to FortiManager and then run on any other FortiGates that are managed by that FortiManager. See Scripts in the FortiManager Administration Guide.

Tooltip

A comment line in a script starts with the number sign (#). Comments are not executed.

To run a script using the GUI:
  1. Click on your username and select Configuration > Scripts.
  2. Click Run Script.
  3. Select the text file containing the script on your management computer, then click OK.

    The script runs immediately, and the Script Execution History table is updated, showing if the script ran successfully.