In this post, I will show you how to create SCCM device collection for DHCP servers. This device collection will use a query to find and group all DHCP servers in your Active Directory setup.
Recently, I got an email asking how to find all the DHCP servers and create a SCCM collection for it. The goal here is to find out all the DHCP servers existing in Active Directory setup 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.
In most organizations, you will find many DHCP servers and managing them using SCCM requires installing the client agent on them. You can use different methods to install the Configuration Manager client software. If you have got a few DHCP servers in the setup, you can manually install SCCM client agent.
The procedure to create DHCP server collection in SCCM is very similar to creating device collection for Windows Server 2022. The only difference is the SCCM WQL query for DHCP server is unique here. Device 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.
Some examples of device collections that you can create in Configuration Manager are as follows:
- Create Microsoft Edge Device Collection in SCCM
- Create SCCM Windows Server 2022 Device Collection
- Windows 11 SCCM Device Collection
- Create SCCM Device Collection for Visual Studio
- SCCM Domain Controllers Collection Query
Create SCCM Device Collection for DHCP Servers
Let’s look at the steps to create SCCM device collection for DHCP servers. Launch the Configuration Manager 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 choose the limiting collection as All Systems.
On the Membership Rules page, 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 the SCCM device collection is not updating, you must review the colleval.log. The Colleval log file logs when collections are created, changed, and deleted by the Collection Evaluator.