13.19. Script: DNS Server Configuration Checker
Configuring a large number of DNS Servers can be a chore. And unless you have a script that routinely checks the configuration on all of your DNS Servers, it's very likely that over time those servers will not have identical configurations. One administrator may make a change on one server and not another. If the servers don't have identical configurations, when problems pop up you may end up spending a lot of time troubleshooting false negatives because of the discrepancies.
Using the WMI DNS Provider, we can write a script that checks the
configuration of a number of servers and updates them as necessary. To
perform the configuration checking, we'll store each setting in a
Dictionary object. Another
option would be to store the settings in a text file and read them into
Dictionary object when the script
starts up. The script iterates over a list of servers, checks the
settings on each server, and modifies settings as necessary.
Here is the script's code:
option explicit on error resume next Dim arrServers Dim strUsername, strPassword Dim dicDNSConfig ' Array of DNS Servers to check arrServers = Array("dns01.rallencorp.com","dns02.rallencorp.com") ' User and password that can modify the config on the DNS Servers strUsername = "dnsadmin" strPassword = "dnspwd" ' This dictionary object will contain the key value pairs for all ' the settings that you want to check and configure on the DNS Servers. Set dicDNSConfig = CreateObject("Scripting.Dictionary") ...