Skip to main content
dbu
Staff
Staff
April 28, 2026

Technical Tip: How to delete custom scan from CLI

  • April 28, 2026
  • 0 replies
  • 43 views

Description

This article describes how to properly delete Custom Scans from the CLI.

Scope

FortiNAC.

Solution

FortiNAC does not allow deleting Custom Scans if they are being used by other features. The following error will appear when trying to delete one.

5f98f717.png



In some environments, there may be a lot of Scans configured, and checking them one by one to see who uses the Custom Scan will cause a lot of headaches. To check which Scans are in use, see Scans in Use. This option lists all the FortiNAC features that reference this specific Custom Scan and disables it.

 
However, the scans in use can also be checked from the CLI by looking at the database tables. 
 

  1. Find the Custom Scan 'ID' and 'supportedProductID' values:


execute db-shell
MariaDB [bsc]> SELECT * FROM EPC_Custom_Product;


2b057174.png


  1. Verify if the Scan has attributes or if it is tied to a scan by using the values learned above: 


MariaDB [bsc]>SELECT (SELECT COUNT(*) FROM EPC_Custom_Product_Attribute WHERE customProductId = 1449276421300253) AS attributes, (SELECT COUNT(*) FROM EPC_Supported_Product WHERE ID = 1422026333667332) AS supported_product_exists, (SELECT COUNT(*) FROM EPC_Scan WHERE ID = 1422026333667332) AS scan_link;


5bfbab05.png


Conditions:

  • attributes >0: DO NOT DELETE. Improper removal from the database may cause scanning errors.

  • attributes = 0: OK to delete. Proceed with the next step.

 

  1. Execute deletion: 


DELETE FROM EPC_Custom_Product WHERE ID = 1449276421300253 LIMIT 1;

 

Never delete directly if the attribute's value is higher than 0.
Detach first and make sure it shows 0, then delete.

 

  1. Verify removal:

SELECT *FROM EPC_Custom_Product WHERE ID = 1449276421300253;


Related document:

Scans in use

    Thought Leadership Security Summit. Outpace New Threats with AI - enhanced defense. Tuesday, Septmeber 15, 8:30 AM - 2:30 PM PT. The Golf Club at Newcastle, WA.
    Virtual event | September 2026. SASE summit. The age of autonomous trust. Register here!