netsh dns and IP settings!
Posted: 17 Dec 2010 07:16
Hey, I'm trying to create two batch files that will automatically modify my network settings when I travel from work to home. I have researched and tried to do it myself, but I can't get it to work flawlessly. The settings I am trying to achieve are as follows:
Home: Static IP and DNS
IP: 192.168.2.15
subnet: 255.255.255.0
gateway: 192.168.2.1
DNS: 192.168.2.1
This is the code I have made myself that does not work:
@echo off
netsh interface ip set address "wireless network connection" static 192.168.2.15 255.255.255.0 192.168.2.1
netsh interface ip set dns “wireless network connection” static 192.168.2.1
Work (or anywhere else):dynamic
ip: auto
dns: auto
this is the code I have used for this that does not work:
@echo off
netsh interface ip set address "wireless network connection" dhcp
netsh interface ip set dns “wireless network Connection” dhcp
exit
And I always run them as administrator, so that is not the problem. Does anyone know what I am doing wrong?
Home: Static IP and DNS
IP: 192.168.2.15
subnet: 255.255.255.0
gateway: 192.168.2.1
DNS: 192.168.2.1
This is the code I have made myself that does not work:
@echo off
netsh interface ip set address "wireless network connection" static 192.168.2.15 255.255.255.0 192.168.2.1
netsh interface ip set dns “wireless network connection” static 192.168.2.1
Work (or anywhere else):dynamic
ip: auto
dns: auto
this is the code I have used for this that does not work:
@echo off
netsh interface ip set address "wireless network connection" dhcp
netsh interface ip set dns “wireless network Connection” dhcp
exit
And I always run them as administrator, so that is not the problem. Does anyone know what I am doing wrong?