> Source: [sk65181](https://support.checkpoint.com/results/sk/sk65181)

# sk65181 - How to use the 'cpmiquerybin' command to list objects and their attributes

| Property | Value |
|----------|-------|
| Solution ID | sk65181 |
| Date Created | 2011-09-08 |
| Last Modified | 2025-05-21 |
| Technical Level | General |
| Products | Multi-Domain Security Management Server |
| Versions | R82.10, R81.20, R82, R82.20 |
| OS | Linux, Gaia |
| Platform | Smart-1 |

## Solution

**Table of Contents:**

* Introduction
* Usage
* Examples
* Related Solutions \& Documentation

Introduction
------------

**Structure of Database Query Tool on Multi-Domain Security Management Server:**

|------------------------------|---------------------------------------------------------------------------------------|
| File                         | Description                                                                           |
| `$MDSDIR/scripts/mdsquerydb` | Script wrapper for loading pre-defined queries and calling `$MDSDIR/bin/cpmiquerybin` |
| `$MDSDIR/bin/cpmiquerybin`   | Binary CPMI Client - core of the Database Query Tool                                  |
| `$MDSDIR/conf/queries.conf`  | File containing pre-defined queries                                                   |

**Description of `$MDSDIR/bin/cpmiquerybin`:**

This command-line CPMI client connects to the specified database, executes a free-format query (first-level fields query/list only), and displays results as either a collection of FW-1 Sets, or as a tab-delimited list of requested fields from each retrieved object.

The target database of the query tool depends on the environment settings of the shell being used by the user.

Usage {#Usage}
--------------

**` [Expert@HostName]# mdsenv <IP address of Name of Domain Management Server>`
` [Expert@HostName]# $MDSDIR/bin/cpmiquerybin <Query_Result_Type> <Database_Name> <Table_Name> <Query> [-a <List_of_Attributes>]`**

|-------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Argument                | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| *Query_Result_Type*     | Requested format of the query result. Possible values: * `attr` - display values of specified (with "`--a`" parameter) field of each retrieved object * `object` - display FW-1 sets containing data of each retrieved object                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| *Database_Name*         | Name of the database to connect to, in double-quotes. Possible values: * `""` * `"mdsdb"`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| *Table_Name*            | Name of the table from which to retrieve the data. Possible values: * `network_objects` * `pv1_administrators`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| *Query*                 | Query specifying objects range for retrieval. Syntax: * Plain query (specific value in the field): `field='value'` * Logical operators: * AND: `field1='value1' & field2='value2'` * OR: `field1='value1' | field2='value2'` * NOT: `! field='value'` <br /> <br /> * Parenthesis: `field1='value1' & ( field2='value2' | field2='value3' )` * Wildcards: `field='*value-suffix'` Fields: * `""` * `name` * `type` *Examples* : * Query all objects whose names start with capital letter "A": `"name='A*'"` * Query all objects of the specified types: `"type='gateway'|type='gateway_cluster'|type='host'"`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| *-a List_of_Attributes* | If `<Query_Result_Type>` was specified as '`attr`', then \<List_of_Attributes\> should contain a comma delimited list (without spaces) of object's fields to display. Note: To see all the attributes, go to the *$FWDIR/conf/objects_5_0.C* file on the Security Management Server / Domain Management Server and search for "`: (Name_of_Object`". Most common attributes: * `__name__` * `type` * `ipaddr` * `sic_name` * `appliance_type` * `connection_state` * `color` * `hosted_by_mds` * `svn_version_name` * `cpver` * `fwver` * `fgver` * `addr_type_indication` * `allow_send_logs` * `log_server` * `firewall` * `management` * `primary_management` * `DAG` * `SmallOffice` * `VPN_1` * `uf_integrated` * `floodgate` * `log_indexer` * `anti_malware_blade` * `anti_virus_blade` * `antispam_integrated` * `application_firewall_blade` * `data_loss_prevention_blade` * `apply_nat_for_cp_conns` * `is_profile_gw` * `is_bypass_sd_under_load` * `av_integrated` * `compliance_blade` * `real_time_monitor` * `reporting_server` * `performancepack` * `ssl_inspection_enabled` * `enable_usercheck` * `monitor_blade` * `misp_active` * `smartevent_intro` * `log_consolidator` * `clp_enable_gateway` * `use_clientless_vpn` * `policy_server` * `proxy_on_gw_enabled` * `mta_enabled` * `connections_limit` * `backup_gw` * `define_logging_servers` * `use_loggers_and_masters` * `hit_count_appi_enable` * `hit_count_fw1_enable` * `http_next_proxy_defined` * `ip_assignment_offer` * `optimize_drops_support` * `encdomain` * `fw_keep_old_conns` * `save_data_conns` * `save_control_conns` |

Examples {#Examples}
--------------------

* Print all objects in the database `""`:

  *\[Expert@HostName\]# cpmiquerybin object "" network_objects ""*
* Print all objects of all types in the database `""` and print their attribute - object's Name:

  *\[Expert@HostName\]# cpmiquerybin attr "" network_objects "type='\*'" -a __name__*
* Print all objects in the database `"mdsdb"` and print their attributes - whether object is defined on MDS and object's IP address:

  *\[Expert@HostName\]# cpmiquerybin attr "mdsdb" network_objects "" -a hosted_by_mds,ipaddr*
* Print all objects in the database `"mdsdb"` and print their attributes - object's Name and object's Color:

  *\[Expert@HostName\]# $MDSDIR/bin/cpmiquerybin attr "mdsdb" network_objects "type='host'" -a __name__,color*
* Print all objects in the database `""` of type Security Gateway and print their attributes - Name and IP Address:

  *\[Expert@HostName\]# cpmiquerybin attr "" network_objects "type='gateway'" -a __name__,ipaddr*
  Note: This will print Check Point Security Gateways as well as 'plain' gateways defined in the 'Nodes' category.
* Print all objects in the database `""` of type Cluster and print their attributes - Name and IP Address:

  *\[Expert@HostName\]# cpmiquerybin attr "" network_objects "type='gateway_cluster'" -a __name__,ipaddr*
* Print all objects in the database `""` of type Cluster and print their attributes - Name, IP Address and the Cluster Members:

  *\[Expert@HostName\]# cpmiquerybin attr "" network_objects "type='gateway_cluster'" -a __name__,ipaddr,cluster_members*
* Print specific cluster object in the database `""` and print its attributes - Name, IP Address and the Cluster Members:

  *\[Expert@HostName\]# cpmiquerybin attr "" network_objects "name='\<Name_of_Cluster_Object\>'" -a __name__,ipaddr,cluster_members*
* Print all objects in the database `""` of type Cluster Member and print their attributes - Name and IP Address:

  *\[Expert@HostName\]# cpmiquerybin attr "" network_objects "type='cluster_member'" -a __name__,ipaddr*
* Print all objects in the database `""` of type Security Gateway, or Cluster and print their attributes - Name, IP Address, Version, Hardware:

  *$MDSDIR/bin/cpmiquerybin attr "" network_objects "type='gateway'\|type='gateway_cluster'" -a __name__,ipaddr,svn_version_name,appliance_type*
* Print all objects in the database `""` of type Host and print their attributes - Name and IP Address:

  *\[Expert@HostName\]# cpmiquerybin attr "" network_objects "type='host'" -a __name__,ipaddr*
  Note: This will print Check Point hosts such as Domain/CLM as well as normal host objects.
* Print all objects in the database `""` of type Group and print their attribute - object's Name:

  *\[Expert@HostName\]# cpmiquerybin attr "" network_objects "type='group'" -a __name__*
* Print all objects in the database `""` of type Network and print their attributes - Name, IP Address and Netmask:

  *\[Expert@HostName\]# cpmiquerybin attr "" network_objects "type='network'" -a __name__,ipaddr,netmask*

Related Solutions \& Documentation {#Related solutions}
-------------------------------------------------------

* [sk85621 - How to get a list of all managed Security Gateways from Provider-1 MDS / Multi-Domain Server](http://supportcontent.checkpoint.com/solutions?id=sk85621)
* Multi-Domain Security Management Administration Guide ([R70.X](http://supportcontent.checkpoint.com/documentation_download?id=8741), [R71.X](http://supportcontent.checkpoint.com/documentation_download?id=10311), [R75](http://supportcontent.checkpoint.com/documentation_download?id=11683), [R75.20](http://supportcontent.checkpoint.com/documentation_download?id=12273), [R75.40](http://supportcontent.checkpoint.com/documentation_download?id=13950), [R75.40VS](http://supportcontent.checkpoint.com/documentation_download?id=16201), [R76](http://supportcontent.checkpoint.com/documentation_download?id=22916), [R77.X](http://supportcontent.checkpoint.com/documentation_download?id=24807), [R80](http://supportcontent.checkpoint.com/documentation_download?id=46532), [R80.10](http://downloads.checkpoint.com/dc/download.htm?ID=54841)) - Chapter "Multi-Domain Security Management Commands and Utilities" - "Command Line Reference" - "cpmiquerybin"

---

# Agent Instructions

This content is from the Check Point Support Center (https://support.checkpoint.com), the official knowledge base for Check Point cybersecurity products.

## Navigating This Knowledge Base

- **Complete index**: [llms.txt](https://support.checkpoint.com/llms.txt)
- **All SK articles**: [SecureKnowledge Sitemap](https://support.checkpoint.com/sitemaps/secureknowledge-sitemap-index.xml)
- **SK article URL pattern**: `https://support.checkpoint.com/results/sk/{skId}`
- **Markdown responses**: AI bot User-Agents automatically receive `text/markdown` content
