FortiManager
FortiManager supports network operations use cases for centralized management, best practices compliance, and workflow automation to provide better protection against breaches.
farhanahmed
Staff
Staff
Article Id 308004
Description This article describes how to use TCL script in FortiManager to fetch serial numbers of FortiAPs and FortiSwitches connected to FortiGate(s).
Scope FortiManager, FortiGate.
Solution

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

 

 

  1. Go to Device Manager -> Scripts,  select type TCL Script, and select 'Create new'.

    Create the following TCL script:

 

 

#!
proc do_cmd {cmd} {
puts [exec "$cmd\n" "# "]
}
puts "FAPs connector this FGT:"
#
# Taking the output of the command in quotations
#
foreach line [split [exec "show wireless-controller wtp\n" "# "] \n] {
#
# Fetching the 'edit' and its value, that is, the serial number of FAP
#
if {[regexp {edit[ ]+"(\w+)"} $line match fap]} {
puts "$fap"
}
}
puts ""
puts "FSWs connector this FGT:"
#
# Taking the output of the command in quotations
#
foreach line [split [exec "show switch-controller managed-switch\n" "# "] \n] {
#
# Fetching the 'edit' and its value, that is, the serial number of FSW
#
if {[regexp {edit[ ]"(\w{16})} $line match fsw]} {
puts "$fsw"
}
}

 

  1. After the script runs successfully, select View Details:

 

7.png

 

 

  1. Select the execution history icon for each FortiGate:

 

 

8.png

 

 

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

 

9.png

 

 

  1. Check the FortiAP and FortiSwitches on the FortiGate for Verification:

 

10.png


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: