?
Solved

Changing DNS address of Netowork interface Card using windows script.

Posted on 2008-10-20
5
Medium Priority
?
590 Views
Last Modified: 2013-11-09
I am using Windows XP, I need one help. I am having two network card. How to change DNS address (Preferred and alternate)  of both network card using windows script?

Thanks in advance.
0
Comment
Question by:cvinodhkumar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 1

Expert Comment

by:kevin_buchanan
ID: 22764539
I have a script that I use to switch the IP Address, Mask, DNS, and GW on my laptop.  I have to do this because the network schema is different at home and work.

SO...maybe this can help!

You will have to modify the interface names to match your NIC interface names.
changeIP.txt
0
 
LVL 12

Accepted Solution

by:
ibu1 earned 150 total points
ID: 22764697
This is the command
netsh interface ip set dns "local area connection" static 62.215.6.51 primary
Put the above command in a batch file.
Put secondary for secondary dns address.
For second network card the name might be "local area connection 2"
0
 

Author Comment

by:cvinodhkumar
ID: 22764935
ibu1,

Good it works but when i type secondary command prompt shows "secondary is not an acceptable value for register"
0
 
LVL 12

Expert Comment

by:ibu1
ID: 22765314
Sorry, try this command
NETSH INTERFACE IP ADD DNS "LOCAL AREA CONNECTION" 62.215.6.5 INDEX=2
0
 
LVL 1

Expert Comment

by:kevin_buchanan
ID: 22773203
Open a command prompt, run this command:
     netsh interface ip dump

This will give you a script to use to create your own batch file to modify your network config.  I have copied mine in the "code snippet" window.

NOTE:  My wireless interface is called "Wireless - Built In Card" - you will likely be called something else...just look for it and you can modify the code.  
netsh
pushd interface ip
set address name="Wireless - Built In Card" source=static addr=10.0.1.22 mask=255.255.255.0
set address name="Wireless - Built In Card" gateway=10.0.1.1 gwmetric=0
set dns name="Wireless - Built In Card" source=static addr=172.16.1.7 register=PRIMARY
add dns name="Wireless - Built In Card" addr=172.16.1.8 index=2
set wins name="Wireless - Built In Card" source=static addr=none
popd
exit

Open in new window

0

Featured Post

Bringing Advanced Authentication to the SMB Market

WatchGuard announces the acquisition of advanced authentication provider, Datablink, with one mission – to bring secure authentication to SMB, mid-market, and distributed enterprises with a cloud-based solution, ideal for resale via their established channel & MSSP community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Determining the an SCCM package name from the Package ID
This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question