Need help on netsh script

I would like to have script files on my desktop I can double click and quickly change my network settings.  However, the dns addresses are not taking.  I will run the script and the ip address works great, but the dns will just change from dynamic to static, without entering addresses.  Can anyone see what I am doing wrong?  I attached my script file
# ---------------------------------- 
# Interface IP Configuration         
# ---------------------------------- 
pushd interface ip
 
# Interface IP Configuration for "Local Area Connection"
 
set address name="Local Area Connection" source=static addr=192.168.1.5 
 
mask=255.255.255.0 gateway=192.168.1.1 gwmetric=0
set dns name="Local Area Connection" source=static addr=192.168.0.1
add dns name="Local Area Connection" addr=192.168.1.1 
netsh int ip set wins name="Local Area Connection" source=static addr=none
 
# Interface IP Configuration for "Wireless Network Connection 2"
 
set address name="Wireless Network Connection 2" source=dhcp 
set dns name="Wireless Network Connection 2" source=dhcp
set wins name="Wireless Network Connection 2" source=dhcp
 
popd
# End of interface IP configuration

Open in new window

BigdoggitAsked:
Who is Participating?
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.

James MontgomeryCommented:
Hello Bigdoggit,

I use batch commands that works well:

netsh interface ip set dns "Wireless Network Connection" dhcp


netsh interface ip set dns "Wireless Network Connection" static 208.67.222.222

Also see
http://www.petri.co.il/configure_tcp_ip_from_cmd.htm

Regards,

JimboEfx
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
canaliCommented:
Try your script without the line 13 is wrong
or the next two line
Gastone Canali
::
:: setstatic.cmd
::
Wmic nicconfig where  description="Local Area Connection" call EnableStatic ("192.168.1.5"), ("255.255.255.0")
Wmic nicconfig where  description="Local Area Connection" call setdnsserversearchorder ("192.168.0.1")

Open in new window

0
canaliCommented:
::
::I forgot the enableDhcp.cmd ..
::
wmic nicconfig where  description="Local Area Connection"  call EnableDHCP
0
Computer101Commented:
Forced accept.

Computer101
EE Admin
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
Scripting Languages

From novice to tech pro — start learning today.