Query based on IP address range

Document ID : KB000095792
Last Modified Date : 16/05/2018
Show Technical Document Details
Introduction:
How do I create a query based on a specific IP address range?

Need a query to list computers in the following IP range:
10.48.0.0 /18 [10.48.0.1 to 10.48.63.254]
10.56.0.0 /16 [10.56.0.1 to 10.56.255.254]
0.57.0.0 /16 [10.57.0.1 to 10.57.255.254]
10.58.0.0 /16 [10.57.0.1 to 10.58.255.254]
Environment:
All versions of CA Client Automation
Instructions:
1. Create a new query by right-clicking Queries and selecting 'New'. 

Figure 1

2. Double click on 'Computers'. 

Figure 2

3. In the Query Designer window, select 'Advanced Argument'.           

User-added image

4. Give a desired 'Pseudo text' and under the 'Additional WHERE clause' field enter the following query:

select object_uuid from ca_agent with (nolock) where agent_type=1 and (ip_address like '10.48.0.%' OR ip_address like '10.48.1.%' OR ip_address like '10.48.2.%' OR ip_address like '10.48.3.%' OR ip_address like '10.48.4.%' OR ip_address like '10.48.5.%' OR ip_address like '10.48.6.%' OR ip_address like '10.48.7.%' OR ip_address like '10.48.8.%' OR ip_address like '10.48.9.%' OR ip_address like '10.48.10.%' OR ip_address like '10.48.11.%' OR ip_address like '10.48.12.%' OR ip_address like '10.48.13.%' OR ip_address like '10.48.14.%' OR ip_address like '10.48.15.%' OR ip_address like '10.48.16.%' OR ip_address like '10.48.17.%' OR ip_address like '10.48.18.%' OR ip_address like '10.48.19.%' OR ip_address like '10.48.20.%' OR ip_address like '10.48.21.%' OR ip_address like '10.48.22.%' OR ip_address like '10.48.23.%' OR ip_address like '10.48.24.%' OR ip_address like '10.48.25.%' OR ip_address like '10.48.26.%' OR ip_address like '10.48.27.%' OR ip_address like '10.48.28.%' OR ip_address like '10.48.29.%' OR ip_address like '10.48.30.%' OR ip_address like '10.48.31.%' OR ip_address like '10.48.32.%' OR ip_address like '10.48.33.%' OR ip_address like '10.48.34.%' OR ip_address like '10.48.35.%' OR ip_address like '10.48.36.%' OR ip_address like '10.48.37.%' OR ip_address like '10.48.38.%' OR ip_address like '10.48.39.%' OR ip_address like '10.48.40.%' OR ip_address like '10.48.41.%' OR ip_address like '10.48.42.%' OR ip_address like '10.48.43.%' OR ip_address like '10.48.44.%' OR ip_address like '10.48.45.%' OR ip_address like '10.48.46.%' OR ip_address like '10.48.47.%' OR ip_address like '10.48.48.%' OR ip_address like '10.48.49.%' OR ip_address like '10.48.50.%' OR ip_address like '10.48.51.%' OR ip_address like '10.48.52.%' OR ip_address like '10.48.53.%' OR ip_address like '10.48.54.%' OR ip_address like '10.48.55.%' OR ip_address like '10.48.56.%' OR ip_address like '10.48.57.%' OR ip_address like '10.48.58.%' OR ip_address like '10.48.59.%' OR ip_address like '10.48.60.%' OR ip_address like '10.48.61.%' OR ip_address like '10.48.62.%' OR ip_address like '10.48.63.%' OR ip_address like '10.56.%.%' OR ip_address like '10.57.%.%' OR ip_address like '10.58.%.%')

User-added image

5. Click OK to save the query.

The query will list machines that fall in the following IP range:
10.48.0.0 /18 [10.48.0.1 to 10.48.63.254]
10.56.0.0 /16 [10.56.0.1 to 10.56.255.254]
0.57.0.0 /16 [10.57.0.1 to 10.57.255.254]
10.58.0.0 /16 [10.57.0.1 to 10.58.255.254]
 
Additional Information:
There are other ways to create a query to list machines in a specific IP range.
Please refer the following:
https://comm.support.ca.com/kb/how-do-i-create-a-query-to-list-machines-in-a-specific-ip-range/kb000070750