[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1434
  • Last Modified:

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

0
Bigdoggit
Asked:
Bigdoggit
  • 2
2 Solutions
 
JimboEfxCommented:
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
 
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

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now