Enable DNS debug logging (VBScript)

This code can be found in Chapter 16 of Active Directory Cookbook, 2nd edition

Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.

Find out how to download all of the VBScript code from this site.

' This VBScript code enables DNS debug logging.

' ---------------------------------------------------------------
' From the book "Active Directory Cookbook" by Robbie Allen
' ISBN: 0-596-00466-4
' ---------------------------------------------------------------

' ------ SCRIPT CONFIGURATION ------
strServer     = "<DNSServerName>"           ' e.g. dc1
' The log level must be in decimal, not hex like dnscmd
intLogLevel   = <EventFlagSumInDecimal>     ' e.g. 65535
arrFilterList = Array("<IPAddress1>")       ' e.g. 192.168.1.12
strFilePath   = <DirectoryAndFilePath>      ' e.g. c:\dnslog.txt
intFileSize   = <NumberOfBytesInDecimal>    ' e.g. 50000000
' ------ END CONFIGURATION ---------

set objDNS = GetObject("winMgmts:\\" & strServer & "\root\MicrosoftDNS")
set objDNSServer = objDNS.Get("MicrosoftDNS_Server.Name="".""")
objDNSServer.LogLevel = intLogLevel
objDNSServer.LogIPFilterList = arrFilterList
objDNSServer.LogFilePath = strFilePath
objDNSServer.LogFileMaxSize = intFileSize
objDNSServer.Put_
WScript.Echo "Enabled DNS Debug Logging on " & strServer

This code has been viewed 1596 times.

New from the creators of TechTasks.com: StatSheet.com