Netsh.exe is a powerful command line tool you can use to configure and manage multiple network connections, quickly and easily from the command line.
Netsh allows for complete configuration of the network card(s) from the command line. Lets start by checking out the current configuration of the Local Arean Connection with this command: netsh interface ip show address "Local Area Connection"
We can change the IP address as well. The following command will set the IP address to 10.0.0.10, on the 255.0.0.0 subnet, with the gateway IP of 10.0.0.1.
netsh interface ip set address name="Local Area Connection" 10.0.0.10 255.0.0.0 10.0.0.1 1
Alternatively, if we want the adapter to use DHCP to obtain its network information, run the following command:
netsh interface ip set address "Local Area Connection" dhcp
Now if you are like me, you travel with a laptop between work and home. You can easily dump your adapter settings to a TXT file and import them quickly and easily with the following two commands:
netsh interface ip dump > c:\home.txt netsh exec c:\work.txt
DNS and WINS address can be set easily, and deleted just as easily with these commands:
netsh interface ip add dns 10.0.0.1
netsh interface ip add dns 10.0.0.2 index=2
netsh interface add wins 10.0.0.1
netsh interface add wins 10.0.0.2 index=2
netsh interface ip delete dns "Local Area Connection" 10.0.0.2
When deleting DNS or WINS address you can specify the IP, or you can use "all" to delte all DNS or WINS addresses. You may also be asking what "index=2" means. When adding an IP address for DNS or WINS, they are listed in the order they are entered, however if you add index=2 (or 3, 4, etc) that specifies where in the list they will appear. We can also use netsh to delete the ARP cache:
netsh interface ip delete arpcache
After we are done we can verify our final configuration and plug into the LAN:
netsh interface ip show config "Local Area Connection"