Recently I have been seeing quite a few laptops arriving in the office with their NICs set to strange DNS entries. It appears that some home broadband routers are able to overwrite the DNS setting for a NIC and apply some strange IP range. The below script when applied in GPO will reset the DNS back to “obtain DNS server address automatically”.
If it fails bear in mind that it requires “elevated priviledges”. You can uncomment the wscript line which will give you an error code. 0 = success and 91 = access denied. For a full list of error codes, see this page here
On Error Resume Next strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colNetCards = objWMIService.ExecQuery _ ("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True") For Each objNetCard in colNetCards arrDNSServers = Array() objNetCard.SetDNSServerSearchOrder(arrDNSServers) ' Wscript.Echo(objNetCard.SetDNSServerSearchOrder(arrDNSServers)) Next