/bundles/itninjaweb/img/Breadcrumb_cap_w.png
Our network has about 4000 machines and our network is not DHCP and I need to add a new DNS server address to all the machines.

I found in the registry where it has the DNS server addresses but the problem is it seems to have a different key name on every machine as it must be specific to each adapter.

I don't neccesarily need to remove any old dns addresses but need to add the new 1 to the list, I would prefer to make the new one primary but thats not critical.

Has anyone mass pushed a dns server address change? Anyways to do this via SMS or AD? Any ideas would be greatly appreciated.

These are all Windows XP workstations if that makes any difference.
0 Comments   [ - ] Hide Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
Answer this question or Comment on this question for clarity

Answers

0
Hi,

found this code snippet at MS


On Error Resume Next

strComputer = "."
strNewDNSServer = "192.168.0.4"

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colNicConfigs = objWMIService.ExecQuery _
("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")

WScript.Echo VbCrLf & "Computer: " & strComputer

For Each objNicConfig In colNicConfigs
intNewArraySize = 0
WScript.Echo VbCrLf & " Network Adapter " & objNicConfig.Index
arrDNSServerSearchOrder = objNicConfig.DNSServerSearchOrder
WScript.Echo " DNS Server Search Order - Before:"
If Not IsNull(arrDNSServerSearchOrder) Then
For Each strDNSServer In arrDNSServerSearchOrder
WScript.Echo " " & strDNSServer
Next
End If
WScript.Echo " Adding " & strNewDNSServer & " to end of " & _
"DNS search order."
intNewArraySize = UBound(arrDNSServerSearchOrder) + 1
ReDim Preserve arrDNSServerSearchOrder(intNewArraySize)
arrDNSServerSearchOrder(intNewArraySize) = strNewDNSServer
intSetDNS = _
objNicConfig.SetDNSServerSearchOrder(arrDNSServerSearchOrder)
If intSetDNS = 0 Then
WScript.Echo " Added " & strNewDNSServer & _
" to end of DNS search order."
Else
WScript.Echo " Unable to change DNS server search order."
End If
Next

WScript.Echo VbCrLf & String(80, "-")

Set colNicConfigs = objWMIService.ExecQuery _
("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")

For Each objNicConfig In colNicConfigs
WScript.Echo VbCrLf & " Network Adapter " & objNicConfig.Index
WScript.Echo " DNS Server Search Order - After:"
If Not IsNull(objNicConfig.DNSServerSearchOrder) Then
For Each strDNSServer In objNicConfig.DNSServerSearchOrder
WScript.Echo " " & strDNSServer
Next
End If
Next




hope that helps
Answered 07/06/2006 by: laszlo
Senior Yellow Belt

Please log in to comment