How to import multiple objects into R80.x Management database using .csv file and then add them to a group

How to import multiple objects into R80.x Management database using .csv file and then add them to a group:
https://supportcenter.checkpoint.com/supportcenter/portal?eventSubmit_doGoviewsolutiondetails=&solutionid=sk113078
https://community.checkpoint.com/t5/General-Management-Topics/Format-of-csv-file-to-add-object-in-group/td-p/8987

.csv files needs to be where you will be running the commands from:

Create the .csv file:

#cat networks.csv

name,subnet,subnet-mask
network1,10.10.10.0,255.255.255.0
network2,20.20.20.0,255.255.255.0
network3,30.30.30.0,255.255.255.0

Note: using underscore character in .csv file (for example, “network1_1”) can cause errors. Use the hyphen instead.

Run the API command:
#mgmt_cli add network –batch networks.csv

Then to add the objects to the right group use:

mgmt_cli set group –batch group-members_full_csv.csv

The CSV should have the following header row:

name,members.add

The name field is for the group and the members.add field will be the host object to add to the group.

The rest of the body of the CSV would then be filled in as you wish:

group1,host1

group1,host2

group1,host3

group2,host1

group2,host2

group2,host3

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s