First, connect your portable computer to location #1, and then manually configure the required settings (such as the IP address, Subnet Mask, Default Gateway, DNS and WINS addresses). Now, you need to export your current IP settings to a text file. Use the following command: netsh -c interface dump > c:\location1.txtWhen you reach location #2, do the same thing, only keep the new settings to a different file: netsh -c interface dump > c:\location2.txtYou can go on with any other location you may need, but we'll keep it simple and only use 2 examples. Now, whenever you need to quickly import your IP settings and change them between location #1 and location #2, just enter the following command in a Command Prompt window (CMD.EXE): netsh -f c:\location1.txtor netsh -f c:\location2.txtand so on. You can also use the global EXEC switch instead of -F: netsh exec c:\location2.txtNetsh.exe can also be used to configure your NIC to automatically obtain an IP address from a DHCP server: netsh interface ip set address "Local Area Connection" dhcpWould you like to configure DNS and WINS addresses from the Command Prompt? You can. See this example for DNS: netsh interface ip set dns "Local Area Connection" static 192.168.0.200and this one for WINS: netsh interface ip set wins "Local Area Connection" static 192.168.0.200Or, if you want, you can configure your NIC to dynamically obtain it's DNS settings: netsh interface ip set dns "Local Area Connection" dhcp What's Netsh? Netsh is a command-line scripting utility that allows you to, either locally or remotely, display, modify or script the network configuration of a computer that is currently running. The following examples based on XP SP2. How to check the connection and opened port netsh -c diag netsh diag>connect iphost chicagotech.net 80 Result: IPHost (chicagotech.net) IPHost = chicagotech.net Port = 80 Server appears to be running on port(s) [80] How to configure the TCP/IP protocol The following command configures the interface named chicagotechnet with the static IP address 10.0.5.99, the subnet mask of 255.255.255.0, and a default gateway of 10.0.5.1: set address name="chicagotechnet" source=static addr=10.0.5.99 mask=255.255.255.0 gateway=10.0.5.1 How to configure Wireless using netsh To configure an defined wireless network, use this command: netsh wlan connect ssid=”mySSID” name=”WLAN-Profil1” To show your current wireless settings, use this command: netsh wlan show settings To add an already exported wireless network profile, use this command: netsh wlan add profile filename="Wireless Network Connection-BOW.xml" How to export and import network configuration to a file With netsh, you can export and import your computer network configuration easy. To export your configuration, just do: netsh –c interface dump > test.txt When you import this configuration, use this command netsh –f test.txt How to use netsh commands for remote access (ras) You can administer remote access servers by typing netsh and then ras. Following are some commands manage RAS: • show activeservers • show client • dump • show tracing • set tracing • show authmode • set authmode • add authtype • delete authtype • show authtype • add link • delete link • show link • add multilink • delete multilink • show multilink • add registeredserver • delete registeredserver • show registeredserver • show user • set user • Netsh ras diagnostics context commands • Netsh ras IP context commands • Netsh ras AppleTalk context commands • Netsh ras AAAA context commands How to open port 8080 using netsh 1) netsh -c firewall 2) set portopening tcp 8080 How to run netsh To run a netsh command, you can start netsh from the Cmd.exe prompt and change to the context that contains the command you want to use. Or you can do netsh -c option. If the contexts that are not available to you, you may receive an error message. For example, if you type netsh -c firewall at the Netsh command prompt, you change to the firewall context, but if you do not have firewall installed the following message appears: The following command was not found: firewall. How to run Netsh with a script If you need to run netsh with many configurations, you can create a script for each configuration and then run it using this command: netsh –f How to use netsh to configure remote computer You can configure remote computer uisng netsh with options “-r” for the machine, “-u” for the username, and “-p” for the password, for example: netsh -r cbg001314 -u cbg001314\blin -p password lan show config. How to switch between static ip and DHCP To switch the specified adapter from a static address to DHCP, type the following command: netsh interface ip set address "chicagotechnet" dhcp To change to a static address, type the following command: netsh interface ip set address "chicagotechnet" static ipaddr subnetmask gateway metric. How to reset IP protocol using netsh For troubleshooting TCP/IP issue, you may need to reset the TCP/IP protocol stack configurations on your interface. To do that, use this command: netsh int ipv4 reset resetlog.txt -------------------------------------------------------------------------------- REM To turn On Windows XP Firewall from command line: netsh firewall set opmode enable REM To Turn Off Windows XP Firewall from command line: netsh firewall set opmode disable REM To enable Windows XP Firewall Don’t Allow Exceptions from command line: netsh firewall set opmode enable disable REM To disable Windows XP Firewall Don’t Allow Exceptions from command line: netsh firewall set opmode enable enable rem Network Settings for Lab in Building Ch netsh interface ip set address name = "Local Area Connection" source = static addr = 100.60.64.42 mask = 255.255.255.192 netsh interface ip set address name = "Local Area Connection" gateway = 100.60.64.2 gwmetric = 1 netsh interface ip set dns name = "Local Area Connection" source = static addr = 100.60.115.1 netsh interface ip add dns name = "Local Area Connection" addr = 100.60.116.1 netsh interface ip show config pause Let’s see what this short batch file does. 1st line: is just a remark, to remind me what this batch file is doing. 2nd line: defines the IP address of my laptop, and sets the corresponding network mask. 3rd line: sets the address of the gateway server. 4th line: first DNS server 5th line: second DNS server (optional) 6th line: shows the new configuration 7th line: waits for a keypress __________________________________________ rem Home Net with DHCP netsh interface ip set address name = "Local Area Connection" source = dhcp netsh interface ip set dns name = "Local Area Connection" source = dhcp netsh interface ip set wins name = "Local Area Connection" source = dhcp netsh interface ip show config pause