- Products
- Learn
- Local User Groups
- Partners
- More
Quantum Spark Management Unleashed!
Introducing Check Point Quantum Spark 2500:
Smarter Security, Faster Connectivity, and Simpler MSP Management!
Check Point Named Leader
2025 Gartner® Magic Quadrant™ for Hybrid Mesh Firewall
HTTPS Inspection
Help us to understand your needs better
CheckMates Go:
SharePoint CVEs and More!
The following one-liner identifies all rules with a hit count of 0 entries. Depending on your environment, you may need to adjust the policy name to ensure the command runs against the correct configuration.
You can store all rules with a hit count of 0 in a file (e.g. delete_rules.txt
). This file can then be processed by a script to automatically remove the listed rules.
mgmt_cli -r true show access-rulebase offset 0 limit 20 name "Network" details-level "standard" show-hits "true" use-object-dictionary true --format json | jq '.rulebase[]| select(.hits.value==0) | {number:.["rule-number"], name:.name, uid:.uid}' > delete_rules.txt
You can use the file delete_rules.txt, which contains the list of rules with a hit count of 0, as input for an automated script. The script should read each line of the file (each line representing a rule), and then construct the appropriate delete command for that rule.
For security reasons,
I’m not sharing the one-liner for direct deletion, as it could easily cause serious damage to the policy.
This program writes the delete commands securely to an echo output; you can then remove the “echo” command in the one-liner and all rules will be deleted on the SMS 😉
jq -r '.uid' delete_rules.txt | while read uid; do
echo mgmt_cli -r true delete access-rule uid "$uid" -s id.txt
done
The id.txt file contains the status of the deletion action.
About CheckMates
Learn Check Point
Advanced Learning
YOU DESERVE THE BEST SECURITY