Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 

Management unused objects script

the_rock
MVP Diamond
MVP Diamond

Hey guys,

Wondering if someone would be kind enough to try this script in their lab? I ran it on mine, but it comes up emoty and its cause I dont have any unused objects in my lab policy.

Below is what I get:


[Expert@CP-MANAGEMENT:0]# ./cp_unused_objects.sh --user admin --password 'maxwe!!' --limit 1000
[Expert@CP-MANAGEMENT:0]# ls
cp_unused_2026-02-08_121753 cp_unused_2026-02-08_121806 cp_unused_objects.sh
[Expert@CP-MANAGEMENT:0]# cd cp_unused_2026-02-08_121753/
[Expert@CP-MANAGEME

...;
TO ACCESS CHECKMATES TOOLBOX it's simple and free

Disclaimer: Check Point does not provide maintenance services or technical or customer support for third party content provided on this Site, including in CheckMates Toolbox. See also our Third Party Software Disclaimer.




0 Kudos
8 Replies

Vincent_Bacher
MVP Silver
MVP Silver

Just had a view on the script using my mobile and have two thoughts.

I was wondering, does it make sense to check for jq right at the start and just exit if it's missing instead of checking nd exiting in the middle of the script?

Also, could it be that the script is a bit inefficient when many many objects come Into the gane by constantly reading and rewriting large data files? Perhaps appending the new data would be much faster. Correct me if I m wrong because  misread the script.

...;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


0 Kudos

the_rock
MVP Diamond
MVP Diamond

Yea...thats why Im trying to see if I can test it on management with lots of unused objects. Let me try my standalone lab and see.

;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


0 Kudos

Vincent_Bacher
MVP Silver
MVP Silver

Just tested on a test domain using

time ./cpunused.sh --user <my user> --password <my pass> --domain "TEST"

Script ran and created empty directory.

;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


0 Kudos

simonemantovani
Participant

Hello

executing the script using bash -x cp_unused_objects.sh ... returns the error:  jq: Unknown option --argjson

I tested the script on an MDS R81.20, JQ version is 1.4 and this version doesn't provide argjson option.

;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


0 Kudos

Vincent_Bacher
MVP Silver
MVP Silver

On our R82 server i get the same error.

;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


0 Kudos

Vincent_Bacher
MVP Silver
MVP Silver

Did some modifications and this version worked on a test domain in our environment:


   ================================================================================ CHECK POINT UNUSED OBJECTS REPORT ================================================================================ Generated: 2026-02-09 11:13:14 Domain: TEST ================================================================================ SUMMARY =========================================================================
...;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


Vincent_Bacher
MVP Silver
MVP Silver

@the_rock  fyi:

Just tested this version on a CMA with more objects.


   ================================================================================ SUMMARY ================================================================================ Total unused objects: 2058 Unused services: 144 Unused non-services: 1914 
  


Time used:


   real 0m27.392s user 0m2.945s sys 0m2.828s 
  



;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


0 Kudos

the_rock
MVP Diamond
MVP Diamond

Will test it shortly.

;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


0 Kudos