Exciting things

Windows script to change network configuration

Currently, I am using a new laptop (with Windows Vista Home Premium) for working at office and home. At home I always use DHCP network configuration (it depends on the ISP). In my company, I have to change to static IP configuration. It takes my time to switch between them. Anyway, I am a lazy man. I want to do all things just by one click or one command. So, I create script to do these thing easily and package them into 2 script file:
ChangeToStaticIPAtWork.bat and ChangeToDynamicIPAtHome.bat.

ChangeToStaticIPAtWork.bat file

netsh int ip set address “Local Area Connection” static your_static_ip your_net_mask your_default_gateway_ip

netsh int ip set dns “Local Area Connection” static your_dns primary

“Local Area Connection” is the name of your network connection. You can find it in the network connections setting.

ChangeToDynamicIPAtHome.bat

netsh int ip set address “Local Area Connection” dhcp
netsh int ip set dns “Local Area Connection” dhcp

When I need to change to any configuration, I just click to run the bat file.
Hope it may help you in necessary case.

Leave a Reply

Your email address will not be published. Required fields are marked *