In this post I will show you how to create SCCM device collection for DHCP servers. We will create a device collection and use the query to find and group all DHCP servers.
Recently I got an email asking me how to find all the DHCP servers and create a SCCM collection for it. The goal was to find out all the DHCP servers present in the network and group them into a device collection.
A DHCP Server is a network server that automatically provides and assigns IP addresses, default gateways and other network parameters to client devices. It relies on the standard protocol known as Dynamic Host Configuration Protocol or DHCP to respond to broadcast queries by clients.
SCCM Collections are nothing but a group of devices or users. Configuration Manager contains several built-in collections but in some cases you may need to create custom collections based on the requirements.
SCCM Device Collection for DHCP Servers
Let’s create a SCCM device collection for DHCP servers. Launch the SCCM console and navigate to Assets and Compliance > Overview > Device Collections. Right click Device Collections and select Create Device Collection.
This brings up create device collection wizard. On the General window, specify the name of the device collection as All DHCP servers. Click Browse and set the limiting collection as All Systems.
On the Membership rules window click Add Rule and from the drop-down select Query Rule. With query rule you dynamically update the membership of a collection based on a query that Configuration Manager runs on a schedule.
On the Query rule properties box, specify the name of the query and click Edit Query Statement. In the Query Language box enter the following query to create SCCM device collection for DHCP servers.
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_SERVICE on SMS_G_System_SERVICE.ResourceId = SMS_R_System.ResourceId where SMS_G_System_SERVICE.DisplayName = "DHCP Server"
To save the Query click OK and close the Query Rule properties window.
On the Summary window, review the settings and on Completion window click Close.
Wait for few minutes while the query runs in the background and finds all the DHCP servers in your network. To speed up things, right click the DHCP server device collection and click Update Membership.
If you notice any issues with the DHCP server query, let me know in the comments section and I will fix it.