This guide demonstrates how to create a SCCM collection by IP or Subnet. You can group all your devices existing in a specific IP subnet or an entire IP address range into a collection and deploy applications or scripts based on requirements.

We all know that collections in Configuration Manager are the best way to group the devices based on specific criteria. For instance, you can create collections to group different versions of Windows 11 and target your apps or scripts.

Note: Before you create a custom device collection based on IP address ranges or subnets, make sure you have Hardware Inventory enabled in the Client Settings. SCCM collects changes to the device’s configuration, like IP addresses. SCCM will also auto-discover change of client IP address in the device collection.

Install and Update Third Party Applications with Patch My PC
Install and Update Third Party Applications with Patch My PC

WQL Query based on IP Range

Use the below query to create a device collection based on IP address or IP address range. For example, the below query groups devices into a collection with IP address range 192.168.100.1-192.168.101.254.

select * from
SMS_R_System inner join SMS_G_System_NETWORK_ADAPTER_CONFIGURATION on SMS_G_System_NETWORK_ADAPTER_CONFIGURATION.ResourceId = SMS_R_System.ResourceId where SMS_G_System_NETWORK_ADAPTER_CONFIGURATION.IPAddress like "192.168.100.%" or SMS_G_System_NETWORK_ADAPTER_CONFIGURATION.IPAddress like "192.168.101.%"

WQL Query based on IP Subnets

Use the below query to create a device collection based on IP subnets. This query groups the devices into a collection with IP subnet 192.168.100.0/24.

select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System where
SMS_R_System.IPSubnets = "192.168.100.0"

Create a device collection by IP or Subnet in SCCM

Open the Configuration Manager console and navigate to Assets and Compliance > Overview > Device Collections. Right-click on Device Collections and select Create Device Collection. Provide a descriptive name for the collection, e.g. Collection – IP Subnet 192.168.100.1/24. Next, choose the limiting collection, such as All Desktops and Server Clients. Click Next.

Create a SCCM Collection by IP or Subnet
Create a SCCM Collection by IP or Subnet

In the Membership Rules tab, click Add Rule and select Query Rule. Click Edit Query Statement and select the Criteria tab. Click Show Query Language and paste the below WQL query. The below query groups all the computers with IP address range 192.168.100.1–192.168.100.254.

select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_NETWORK_ADAPTER_CONFIGURATION on SMS_G_System_NETWORK_ADAPTER_CONFIGURATION.ResourceID = SMS_R_System.ResourceId where SMS_G_System_NETWORK_ADAPTER_CONFIGURATION.IPAddress like "192.168.100.%" order by SMS_R_System.Name, SMS_R_System.SMSUniqueIdentifier
Create a SCCM Collection by IP or Subnet
Create a SCCM Collection by IP or Subnet

Click Next on the Summary window, and on the completion window, click Close. Wait for a few minutes while the collection is updated. You should find all the computers grouped into the device collection based on the IP address or IP subnet provided in the query.

Create a SCCM Collection by IP or Subnet
Create a SCCM Collection by IP or Subnet

Further Reading

Check out some examples of creating collections in Configuration Manager.

Still Need Help?

If you need further assistance on the above article or want to discuss other technical issues, check out some of these options.

Leave a Reply

Your email address will not be published. Required fields are marked *

Prajwal Desai

Prajwal Desai is a technology expert and 10 time Dual Microsoft MVP (Most Valuable Professional) with a strong focus on Microsoft Intune, SCCM, Windows 365, Enterprise Mobility, and Windows. He is a renowned author, speaker, & community leader, known for sharing his expertise & knowledge through his blog, YouTube, conferences, webinars etc.