''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' ' DNS Update Configuration Script ' ' Author: Mike McGuire - mike@mikejmcguire.com ' ' Disables DNS Registration on interfaces that do not have a default gateway. ' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Option Explicit On Error Resume Next Const HKEY_LOCAL_MACHINE = &H80000002 Dim oRegistry, oNetworks, oNetwork, oShell Dim strInterfaceKey, strData strInterfaceKey = "SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces" Set oShell = CreateObject("WScript.Shell") Set oRegistry = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv") Set oNetworks = GetObject("winmgmts:\\.\root\CIMV2").ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = TRUE") For Each oNetwork In oNetworks If Not IsNull(oNetwork.IPAddress) Then If Not IsArray(oNetwork.DefaultIPGateway) Then strData = "0" ' Disabled Else strData = "1" ' Enabled End If oRegistry.SetDWORDValue HKEY_LOCAL_MACHINE, strInterfaceKey & "\" & oNetwork.SettingID, "RegistrationEnabled", strData End If Next oShell.Run "ipconfig /registerdns" Set oRegistry = Nothing Set oNetworks = Nothing Set oShell = Nothing