Network Scripts

This is how I make my life easier. I am constantly moving between home base and client sites and this means I need to make network configuration changes almost daily. It gets even crazier than that some days too. Some sites have multiple VLANs with no routing and I need to change network address space for each VLAN I’m working on. These are the scripts that make my life easier.

My new work PC doesn’t have a switch to turn WiFi on or off. Since I keep the lid closed and in a docking station at work I can’t use the FN+Hotkey to turn WiFi on or off. So I created these batch files to turn the adapter on and off instead. Each one lives in its own batch file and I simply “Run as Administrator” to execute.

File "Disable Wireless Connection":

netsh interface set interface "Wireless Network Connection" Disable
netsh interface set interface "Wireless Network Connection" Disable

File “Enable Wireless Connection”:

 

netsh interface set interface "Wireless Network Connection" Enable

I used to have a script that let me configure and save network configurations but when I switched PCs a few years ago I never updated it. Instead I created a bunch of batch files like this one:

File “Wired Adapter Client Video Lan”:

netsh interface ip set address "Local Area Connection" static 198.9.200.40 255.255.255.0 192.9.200.1
pause

When you run it as administrator you can see it is designed to set a static IP address of the network I need to work on. These networks don’t have external network access so I didnt’ specify the DNS servers.

This is how you set the adapter back to DHCP
netsh interface ip set address "Local Area Connection" dhcp

These scripts mean I don’t need to take the time to muddle through the GUI and waste time looking up which IP address to use and typing it in. When laying out the networks I keep track of which IP is used for my configuration PC and leave that IP address free for my use.