Recently, we shut down some old DNS servers which had been replaced by new ones in a different subnet. Now the clients get their DNS search order by DHCP so no worries about that. But how to make sure that no servers try to contact those old DNS servers after they have been shut down?

Well SCCM can help!

Extend the hardware inventory data

First you have to make sure that SCCM has the information you’re looking for. Therefore, go to Administration -> Client Settings -> <YourClientSettingThatAppliesToServers> -> Hardware Inventory -> Set Classes ...
There, open Network Adapter Configuration and check DNS Server Search Order.

This makes sure that the next time the hardware inventory cycle runs, the DNS Server Search order is documented and sent to the SCCM server where you can use it in a query or report … or whatever.

Create a WSQL query

In the SCCM Monitoring page, open Queries and create a new query. Add the below query statement:

SELECT SMS_R_System.Name, SMS_G_System_OPERATING_SYSTEM.Caption, SMS_G_System_NETWORK_ADAPTER_CONFIGURATION.DNSServerSearchOrder 
FROM  SMS_R_System
INNER JOIN SMS_G_System_OPERATING_SYSTEM ON SMS_G_System_OPERATING_SYSTEM.ResourceID = SMS_R_System.ResourceId
INNER JOIN SMS_G_System_NETWORK_ADAPTER_CONFIGURATION ON SMS_G_System_NETWORK_ADAPTER_CONFIGURATION.ResourceID = SMS_R_System.ResourceId
WHERE SMS_G_System_OPERATING_SYSTEM.Caption LIKE "Microsoft Windows Server%"
AND SMS_G_System_NETWORK_ADAPTER_CONFIGURATION.IPEnabled = 1
AND SMS_G_System_NETWORK_ADAPTER_CONFIGURATION.DNSServerSearchOrder like "%192.168.%"

Now wait for the hardware inventory cycle to run and then run the query. Keep in mind that the information is not live so if you change something on the servers, you’ll have to be SCCM-patient and wait for the next hardware inventory cycle.

Change the DNS Server Search Order

If the number of results is too high to change the configuration manually, see http://eskonr.com/2017/02/how-to-find-and-update-dns-server-search-order-using-sccm-configmgr/ for information on how to use SCCM to change the DNS Server Search Order.

Careful: the SQL statement there is a SQL statement (“Seriously?” – “Yes. SQL. Not WSQL.” – “Oh. Right.”) and I haven’t testet the config script. So as always: have fun but use at your own risk!