|
Follow the initial steps from this article on how to enable and run TCL scripts in FortiManager:
Technical Tip: How to use TCL script...existing route
- Go to Device Manager -> Scripts, select type TCL Script, and select 'Create new'.
Create the following TCL script:
# Define VDOM name set vdom_name "root"
# Check if VDOMs are enabled set status [exec "get system status\n" "# " 15] set vdom_enabled false if {![regexp {Virtual domain configuration: disable} $status]} { set vdom_enabled true }
# Enter VDOM if enabled if {$vdom_enabled} { puts "\n" puts "=================================================" puts "VDOMs are enabled. Switching to VDOM: $vdom_name" puts "=================================================" puts "\n" exec "end\n" "# " exec "config vdom\nedit $vdom_name\n" "# " } else { puts "\n" puts "================================================" puts "VDOMs are disabled. Staying in global context." puts "================================================" puts "\n" }
# FortiAPs output puts "FortiAPs connected to this FGT:" puts "-------------------------" set fap_found false foreach line [split [exec "show wireless-controller wtp\n" "# "] \n] { if {[regexp {edit\s+"(\w+)"} $line match fap]} { puts $fap set fap_found true } } if {!$fap_found} { puts "None found." } puts "================================================" ;# <-- Extra blank line to separate sections
# FortiSwitches output puts "FortiSwitches connected to this FGT:" puts "-------------------------" set fsw_found false foreach line [split [exec "show switch-controller managed-switch\n" "# "] \n] { if {[regexp {set sn\s+"(\w+)"} $line match fsw_sn]} { puts $fsw_sn set fsw_found true } } if {!$fsw_found} { puts "None found." } puts ""
# Exit VDOM context if it was entered if {$vdom_enabled} { exec "end\n" "# " } puts "\n"
The script takes into consideration whether VDOMs are enabled on the FortiGate. The default is set to 'root' (in the second line of the script).
- After the script runs successfully, select View Details:

- Select the execution history icon for each FortiGate:

- This will show the details of the FortiAP and FortiSwitches connected to the FortiGate:

Note: In FortiManager, if FortiSwitch Manager and AP Manager are being used, the Export to Excel option can be used to get the list of the devices: Importing and exporting FortiSwitch devices. Importing and exporting FortiAP devices.
Related documents:
|