Link to home
Start Free TrialLog in
Avatar of creative555
creative555

asked on

script to change DNS settings - Internet Protocol (TCP/IP) properties

I was wondering if it is possible to make a script to change DNS entries to the following two DNS servers? The other settings such as IP, GT, and SM should stay intact. This change would be on the Internet Protocol (TCP/IP) properties where we have static entries for each server such as IP, SM, DG, Primary DNS Server and Alternative DNS server.
 
-The DNS servers should be changed to the following - for example.  DNS 1: 196.168.1.5. DNS 2: 196.168.6
Even better if I could update all the servers at once if it is possible, but at least it would be great if I have the script to run on each server instead of typing manually the IPs for DNS manually
ASKER CERTIFIED SOLUTION
Avatar of footech
footech
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of creative555
creative555

ASKER

Oh. Wonderful! I will give it a try. What if I just want to run the script locally on the server that I am doing and not multiple servers.

What would that script would be? Could you please remove the additional lines so I have the script for individual/local server as well.

Thank you so much!!
Excellent! Works perfect!!!!
BTW, to change it to work locally, just use "localhost" or "." as the server name, or omit the -computername parameter from the Get-WmiObject command.