Discussion Locked

DNS Group policy

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

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

3 replies

by bfilmfan

DHCP is the way to do that.

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

by newssubscripton

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

by birojit.nath

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

This discussion is closed to new replies.