General discussion

Locked

DNS Group policy

By nick.askew ·
Hi All

I am running a 2003 servers AD and i need to change the DNS numbers to all the clients (XP Sp1) on a local site, is there any easy way to do this.

I have set up a GPO for this but it is not changing the DNS numbers on the client PC's

All help greatfully recieved

Nico

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by BFilmFan In reply to DNS Group policy

DHCP is the way to do that.

There is not a GPO which changes all of the client's IP address information.

Collapse -

by newssubscripton In reply to DNS Group policy

Use a log on Script like this on
On Error Resume Next

strComputer = "."
strOldDNSServer = "192.168.1.3"
strNewDNSServer = "192.168.2.5"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colNicConfigs = objWMIService.ExecQuery _
("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
For Each objNicConfig In colNicConfigs
arrDNSServerSearchOrder = objNicConfig.DNSServerSearchOrder
If Not IsNull(objNicConfig.DNSServerSearchOrder) Then
For Each strDNSServer In objNicConfig.DNSServerSearchOrder
Next
End If
blnFound = 0
For i = 0 to UBound(arrDNSServerSearchOrder)
If arrDNSServerSearchOrder(i) = strOldDNSServer Then
arrDNSServerSearchOrder(i) = strNewDNSServer
blnFound = 1
End If
Next
If blnFound Then
retSetDNS = objNicConfig.SetDNSServerSearchOrder(arrDNSServerSearchOrder)
If retSetDNS = 0 Then
Else
WScript.Echo " Unable to change DNS server search order."
End If
Else
End If
Next

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

Collapse -

by birojit.nath In reply to DNS Group policy

Configyre the DNS in The DHCP. By default if any one gets the I.P from DHCP he will also get the DNS server.

Back to Windows Forum
3 total posts (Page 1 of 1)  

Related Discussions

Related Forums