<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic rename_objects.sh - bash script using CSV to bulk rename objects (on MDS) in Scripts</title>
    <link>https://community.checkpoint.com/t5/Scripts/rename-objects-sh-bash-script-using-CSV-to-bulk-rename-objects/m-p/80372#M718</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Features&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Auto-detect API version of MDS.&lt;/LI&gt;
&lt;LI&gt;Use CSV file for defining all objects to rename.&lt;/LI&gt;
&lt;LI&gt;Bulk rename of TCP service objects is supported.&lt;/LI&gt;
&lt;LI&gt;Bulk rename of UDP service objects is supported.&lt;/LI&gt;
&lt;LI&gt;Bulk rename of Hosts objects is supported.&lt;/LI&gt;
&lt;LI&gt;Bulk rename of Networks is supported.&lt;/LI&gt;
&lt;LI&gt;Bulk rename of Service Groups is supported.&lt;/LI&gt;
&lt;LI&gt;Bulk rename of Network Groups is supported.&lt;/LI&gt;
&lt;LI&gt;Auto publish or no publish after successfully renaming the objects.&lt;/LI&gt;
&lt;LI&gt;Auto discard complete session when return value of API call to rename object is not 0 (0=SUCCESS).&lt;/LI&gt;
&lt;LI&gt;Display errors/warnings when session is discarded.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;CSV file&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;Each CSV file has to start with a special line:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;name,new-name&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;From that point you can add new lines with current name&amp;lt;comma&amp;gt;new name&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Example CSV file with host objects:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;name,new-name&lt;BR /&gt;&lt;/FONT&gt;&lt;FONT face="courier new,courier"&gt;Gooogle-DNS1,Google-DNS1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Googgle-DNS2,Google-DNS2&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Script example&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;./rename_objects.sh johndoe DMS-CP-1 CHG4726 hosts rename_hosts.csv nopublish&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Usage&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Usage:
  ./rename_objects.sh [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
                 objects.
  sessionaction  Can be either nopublish|publish.

Example:
  ./rename_objects.sh 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:
name,new-name

From this point you can add new lines with the current name and the new name of
the objects:
Gooogle-DNS1,Google-DNS1
Googgle-DNS2,Google-DNS2
etc...

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.&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can download &lt;A href="https://tools.checkpoint.engineer/rename_objects.sh" target="_self"&gt;rename_objects.sh&lt;/A&gt; on your MDS using the following CLI one-liner:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;curl_cli -o rename_objects.sh tools.checkpoint.engineer/rename_objects.sh &amp;amp;&amp;amp; chmod +x rename_objects.sh&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;or in a browser:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://tools.checkpoint.engineer/rename_objects.sh" target="_blank" rel="noopener"&gt;https://tools.checkpoint.engineer/rename_objects.sh&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;GitHub repository:&amp;nbsp;&lt;A href="https://github.com/Rick-Hoppe/rename-objects" target="_self"&gt;https://github.com/Rick-Hoppe/rename-objects&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;Changelog&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;0.1 Initial version&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;0.2 Added dos2unix to remove Windows formatting&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 14 Apr 2026 08:24:07 GMT</pubDate>
    <dc:creator>RickHoppe</dc:creator>
    <dc:date>2026-04-14T08:24:07Z</dc:date>
    <item>
      <title>rename_objects.sh - bash script using CSV to bulk rename objects (on MDS)</title>
      <link>https://community.checkpoint.com/t5/Scripts/rename-objects-sh-bash-script-using-CSV-to-bulk-rename-objects/m-p/80372#M718</link>
      <description>24</description>
      <pubDate>Tue, 14 Apr 2026 08:24:07 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Scripts/rename-objects-sh-bash-script-using-CSV-to-bulk-rename-objects/m-p/80372#M718</guid>
      <dc:creator>RickHoppe</dc:creator>
      <dc:date>2026-04-14T08:24:07Z</dc:date>
    </item>
    <item>
      <title>Re: rename_objects.sh - bash script using CSV to bulk rename objects (on MDS)</title>
      <link>https://community.checkpoint.com/t5/Scripts/rename-objects-sh-bash-script-using-CSV-to-bulk-rename-objects/m-p/153522#M981</link>
      <description>&lt;P&gt;Is this supported for single domain server running on R80.40 ?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2022 06:50:43 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Scripts/rename-objects-sh-bash-script-using-CSV-to-bulk-rename-objects/m-p/153522#M981</guid>
      <dc:creator>_khard</dc:creator>
      <dc:date>2022-07-21T06:50:43Z</dc:date>
    </item>
    <item>
      <title>Re: rename_objects.sh - bash script using CSV to bulk rename objects (on MDS)</title>
      <link>https://community.checkpoint.com/t5/Scripts/rename-objects-sh-bash-script-using-CSV-to-bulk-rename-objects/m-p/153655#M983</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.checkpoint.com/t5/user/viewprofilepage/user-id/70943"&gt;@_khard&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;This script was specifically written for a Multi-Domain environment, but you can easily modify it to work on a single management server.&lt;/P&gt;
&lt;P&gt;It probably will work if you modify line 273 to:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;mgmt_cli login user &lt;/SPAN&gt;&lt;SPAN class="pl-s"&gt;&lt;SPAN class="pl-pds"&gt;"&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;$1&lt;/SPAN&gt;&lt;SPAN class="pl-pds"&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN class="pl-k"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN&gt; id.txt&lt;BR /&gt;&lt;BR /&gt;Note: You still need to enter a (fake) domainname but it will not be used to login. To remove this it would require a lot more custom modifications.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jul 2022 21:00:57 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Scripts/rename-objects-sh-bash-script-using-CSV-to-bulk-rename-objects/m-p/153655#M983</guid>
      <dc:creator>RickHoppe</dc:creator>
      <dc:date>2022-07-22T21:00:57Z</dc:date>
    </item>
    <item>
      <title>Re: rename_objects.sh - bash script using CSV to bulk rename objects (on MDS)</title>
      <link>https://community.checkpoint.com/t5/Scripts/rename-objects-sh-bash-script-using-CSV-to-bulk-rename-objects/m-p/153663#M984</link>
      <description>&lt;P&gt;Nice work !&lt;/P&gt;
&lt;P&gt;I have some more features how to further develop this script.&lt;/P&gt;
&lt;P&gt;1. Iterate over all Domains on MDS and check if the object to be renamed is existing on all Domains, not only on specified as an argument. You can specify only one Domain, but if you dont, the script will rename it on all Domains.&lt;/P&gt;
&lt;P&gt;2. Integrate Global Domain, if present.&lt;/P&gt;
&lt;P&gt;3. Rename the network objects searched by the IP addresses (not via name).&lt;/P&gt;
&lt;P&gt;4. Automatic detection of SMS or MDS.&lt;/P&gt;</description>
      <pubDate>Sat, 23 Jul 2022 05:42:29 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Scripts/rename-objects-sh-bash-script-using-CSV-to-bulk-rename-objects/m-p/153663#M984</guid>
      <dc:creator>JozkoMrkvicka</dc:creator>
      <dc:date>2022-07-23T05:42:29Z</dc:date>
    </item>
  </channel>
</rss>

