Friday 29 June 2007

"netsh" Scripting -- Changing IP settings

"netsh" is a powerful command-line tool for network admin.

If you are tired to click your mouse button to open and close several windows to change IP settings on your laptop between your office and your home, then try this and save them into .VBS format on your desktop.

For network A (by manually assigned):

netsh int ip set address name=”Local Area Connection” source=static addr=192.168.0.xxx mask=255.255.255.0
netsh int ip set address name=”Local Area Connection” source=static gateway=192.168.0.xxx gwmetric=1
netsh int ip set dns name=”Local Area Connection” source=static addr=192.168.1.xxx

NOTE: you might need to check the name of your network connection.

For network B (by DHCP):

netsh int ip set address name=”Local Area Connection” source=dhcp
netsh int ip set dns name=”Local Area Connection” source=dhcp

No comments: