Showing results for 
Search instead for 
Did you mean: 
Create a Post
Silver bash script using CSV to bulk rename objects (on MDS)



I've created a bash script to bulk rename objects listed in a CSV file. You need to run it on a MDS with the Management API enabled.


  • Auto-detect API version of MDS.
  • Use CSV file for defining all objects to rename.
  • Bulk rename of TCP service objects is supported.
  • Bulk rename of UDP service objects is supported.
  • Bulk rename of Hosts objects is supported.
  • Bulk rename of Networks is supported.
  • Bulk rename of Service Groups is supported.
  • Bulk rename of Network Groups is supported.
  • Auto publish or no publish after successfully renaming the objects.
  • Auto discard complete session when return value of API call to rename object is not 0 (0=SUCCESS).
  • Display errors/warnings when session is discarded.


CSV file

Create a seperate CSV file for each object type you want to rename. This means you cannot mix object types like TCP and UDP services into one CSV file. When running the script you have to specify which object type the CSV file contains.

Each CSV file has to start with a special line:


From that point you can add new lines with current name<comma>new name

Example CSV file with host objects:



Script example

./ johndoe DMS-CP-1 CHG4726 hosts rename_hosts.csv nopublish

This allows user johndoe to login to the domain DMS-CP-1. It will use changenumber CHG4726 for session name and description. Furthermore you tell that it will find host objects in the CSV file rename_hosts.csv. Last but not least the nopublish action will force a logout of the API session after succesfully renaming the objects. This will allow you to takeover the session in SmartConsole for manual verification and a manual publish if you're satisfied with the results.



  ./ [ARGUMENTS]...

Rename objects listed in a CSV file using the Management API of a Check Point
Multi-Domain Management Server running on R80.x

Mandatory arguments to supply when running the script.
  username       Put your username that has Write access to the DMS here.
  domainname     Put the name of the DMS here.
  changenumber   Put in your changenumber. It will be used for session info.
  objecttype     Can be either tcp|udp|hosts|networks|servicegroups|networkgroups.
  filename       The CSV file that lists the current and new names of the
  sessionaction  Can be either nopublish|publish.

  ./ johndoe DMS-CP-1 CHG4726 hosts rename_hosts.csv nopublish

If there are errors or warnings when renaming objects the complete session will
be discarded. A log will be shown so you can fix it before trying again.

The CSV file should always start with this line:

From this point you can add new lines with the current name and the new name of
the objects:

When you choose not to publish you can takeover the session in SmartConsole.
In SmartConsole you can then verify the changes and publish it manually.


You can download on your MDS using the following CLI one-liner:

curl_cli -o && chmod +x

or in a browser:



0.1 Initial version

My blog:
0 Kudos