Created on
‎11-07-2025
03:15 AM
Edited on
‎11-07-2025
03:15 AM
By
Anthony_E
| Description |
This article explains how to send a reply in a TCL script from FortiManager to a query from the FortiGate. |
| Scope |
FortiManager v7.4 and FortiGate v7.4. |
| Solution |
When a TCL script is run from the FortiManager on a FortiGate, some commands send a query from the FortiGate. These queries mostly need a reply y/n, for example:
This operation will reboot the system !
In this case, the script needs to reply to this query to continue. To show what happens, the command execute reboot was used as it is a command that will reply with a query, and it is easy to verify.
In the following script example, the first reply to the query is 'n', and the script continues, and then the reply is 'y', where the device will reboot. The example script was used on the FortiGate with vdoms enabled.
To enable Scripting, configure the following CLI settings on the FortiManager:
FMG # config system admin setting (setting) set show_schedule_script enable
In the GUI, navigate to Device manager -> Scripts -> CLI/TCL script and select 'Create new'
Create a TCL script using the following text:
#! do_cmd "config vdom" ## First reply n to the query ## This operation will reboot the system ## The script continues to configure the device to show the response has taken affect ie no reboot ## when the reply is yes the FGT reboots ## This time the response on the query is y ##This operation will reboot the system
To verify the outcome of this script, navigate in the GUI to System Settings -> Task Monitor, find the script, and View Script Execution History:
-------Executing time: Fri Oct 24 14:25:56 2025-----------
Starting log (Run on device) config vdom FGVM02TM22000891 (vdom) # FGVM02TM22000891 (root) # FGVM02TM22000891 (interface) # FGVM02TM22000891 (port2) # FGVM02TM22000891 (port2) # FGVM02TM22000891 (port2) # FGVM02TM22000891 (port2) # FGVM02TM22000891 (interface) # FGVM02TM22000891 (root) # FGVM02TM22000891 # FGVM02TM22000891 (global) # FGVM02TM22000891 (global) #
FGVM02TM22000891 # FGVM02TM22000891 (vdom) # FGVM02TM22000891 (root) # FGVM02TM22000891 (interface) # FGVM02TM22000891 (Mytest) # FGVM02TM22000891 (Mytest) # FGVM02TM22000891 (Mytest) # FGVM02TM22000891 (Mytest) # FGVM02TM22000891 (Mytest) # FGVM02TM22000891 (Mytest) # FGVM02TM22000891 (interface) # FGVM02TM22000891 (root) # FGVM02TM22000891 # FGVM02TM22000891 (global) # FGVM02TM22000891 (global) #
Possible debugs to take.
On FortiGate:
diagnose debug cli 8 diagnose debug enable
On FortiManager:
diagnose debug application depmanager 255 diagnose debug application fgfm 255 <device name> diagnose debug timestamp enable diagnose debug enable |
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2025 Fortinet, Inc. All Rights Reserved.