/build/static/layout/Breadcrumb_cap_w.png

deploying a DNS address change to all PC's ?

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   [ + ] Show comments

Answers (1)

Posted by: laszlo 14 years ago
Senior Yellow Belt
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
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ