Create a SCCM Device Collection by IP or Subnet

Create a SCCM device collection based on ip or subnet

This post will show you how to create a SCCM Device Collection by IP or Subnet. This is useful for applying scripts or policies to devices that are in a particular subnet. For creating a device collection see this post. This code below is the Query Rule code you will put in your membership rules.

Query Code

Paste this code in the Show Query Language menu in your query rule. Notice the IP 192.168.1.% change this to your needs. The % is a wildcard so put that in the octet you want as a wildcard. In my example this will include any devices that have an IP in the range of 192.168.1.1-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.1.%"

It should look something like this:

Create a SCCM device collection based on ip or subnet
Tagged : / /