Putting It Together: Configuration Check Script

Building on the examples we’ve used so far in this chapter, we can now write a robust script to check name server configurations. Such a script can be very important, especially in large environments with many name servers. Unless you have a script that routinely checks the configuration on all of your name servers, it’s very likely that those servers will not have an identical configuration. If they don’t have identical configurations, then when problems pop up, you may end up spending a lot of time troubleshooting because of the discrepancies between the name servers.

To perform the configuration checking, we store each setting in a VBScript Dictionary object. For those accustomed to other languages such as Perl, a Dictionary object is the VBScript analog to a hash or associative array. Another option would be to store the settings in a text file and read them into a Dictionary object when the script starts up. The following example shows the configuration check code:

option explicit on error resume next Dim arrServers Dim strUsername, strPassword Dim dicDNSConfig ' Array of DNS servers to check arrServers = Array("terminator.movie.edu","fx.movie.edu") ' 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") ...

Get DNS on Windows Server 2003, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.