Force DNS Settings on Domain Network

So I know there is a way but can't seem to find it.  Server 2012 Domain Network.  How do I force all workstations to use the IP and DNS settings I want on the network workstations.  A lot of workstations have the DNS manually configured and I want to force it thru the domain instead of going to each workstation manually.  The group policy in Server 2012 under admin templates/network DNS settings say that is only for Windows XP professional only.  I changed the settings just to try and this did not work.
iTeam HelpDeskAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Justin YeungSenior Systems EngineerCommented:
Powershell can do the job

search the target machine's network adapter that has ip 192.168.0.x and set Adapter with deserved DNS address
$DNS = "192.168.1.1","192.168.2.1"
$Nic = Get-WmiObject -class win32_networkadapterconfiguration -computername FQDNofcomputer | ? {$_.Ipaddress -like "192.168.0.*"}
$Nic.SetDNSServerSearchOrder($DNS)

Open in new window


if you want to change the dns server to use dhcp dns remove $DNS from $Nic.setDNSServerSearchOrder($DNS)
$Nic.SetDNSServerSearchOrder()

Open in new window


You can also run this to set a scope of computer, either reading from AD or from a txt file.
I do not know how many machines do you have in your environment

search machine in AD that is windows 7 and adapter that has an IP address
Import-module ActiveDirectory
$Computers = Get-Adcomputer -filter {operatingsystem -like "*windows 7*"} -properties OperatingSystem
foreach ($Computer in $Computers)
{
$DNS = "192.168.1.1","192.168.2.1"
$Nic = Get-WmiObject -class win32_networkadapterconfiguration -computername $Computer.dnshostname| ? {$_.Ipaddress -ne $null}
$Nic.SetDNSServerSearchOrder($DNS)
}

Open in new window


or do it from txt file

import C:\computers.txt file and find adapter that has an IP address (not equal nothing)
$Computers = get-content c:\computers.txt
foreach ($Computer in $Computers)
{
$DNS = "192.168.1.1","192.168.2.1"
$Nic = Get-WmiObject -class win32_networkadapterconfiguration -computername $Computer | ? {$_.Ipaddress -ne $null}
$Nic.SetDNSServerSearchOrder($DNS)
}

Open in new window


hope this help.
0
Dan McFaddenSystems EngineerCommented:
The most effective way of managing TCP/IP settings is with DHCP.  Worst case scenario is that you will have to reconfigure the TCP/IP settings on each workstation to move the config over to DHCP.

You could avoid visiting each workstation by pushing a script at logon that reconfigs the NICs at the user's next logon.

reference link: https://social.technet.microsoft.com/Forums/windowsserver/en-US/cd2bbb19-68f3-4cfe-86b3-05a7821c7fde/script-for-xpsp3-machines-through-windows-2008-r2-group-policy?forum=winserverGP

Process would be:

1. install DHCP service (on a DC will be fine for small deployments, if you have a virtualized environment available, on a dedicated VM will do)
2. define your subnet and the blocks of IP addresses that DHCP can give out
3. define scope attributes
3a. global scope attributes (dns domain name, node type, dns servers*, wins servers*)
3b. subnet specific attributes (router, dns servers*, wins servers*)

* sometimes it make sense to place the dns and wins servers in global if your environment has only 1 site.  If you have more than one site, it may make sense to move the attributes to the subnet scope because there may be local servers providing dns, wins, etc.

4. test the DHCP config
5. deploy logon script
6. have users either logoff then back on or just reboot their computers.

I highly recommend DHCP.  It gives you control management of your IP space as well as control over the device using the service.  Its much more manageable than trying to keep track of multiple computers that are manually configured.

Dan

Dan
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
iTeam HelpDeskAuthor Commented:
This was what I ended up doing last night.  Thank you.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2012

From novice to tech pro — start learning today.