Application Delivery Management
Application Modernization & Connectivity
CyberRes
IT Operations Management
By Bryan Keadle
GUI interfaces are great for occassional reconfiguration of your Windows system, particular your network configuration settings. However, sometimes in the process of troubleshooting, doing network diagnostics, or moving between different network environments, using the GUI to configure and reconfigure your Windows network settings (IP address, DNS settings, enable/disable interfaces) can be a hassle.
Provided with Windows XP and 2000 is a command line interface to controlling your network properties, netsh.exe. But navigating the options for using netsh.exe can be a real challenge, and because it's difficult options and syntax, it often gets ignored.
I've simplified the syntax for using netsh.exe by writing a batch file "wrapper" for it, netshx.cmd. With netshx.cmd you can:
If you find yourself messing with your network settings very often, you'll really appreciate this simplified command to make the changes you need.
== VERBS == |
SET |
set NIC configuration eg: netshx SET "Interface_name" "IP_Addr" "Subnet_mask" "Def_gw" eg: netshx SET "Interface_name" DHCP |
DNS | set DNS coniguration eg: netshx DNS "Interface_name" "DNS_IP_ADDRESS" |
ENABLE | enable interface eg: netshx ENABLE "Interface_name' |
DISABLE | disable interface eg: netshx DISABLE "Interface_name' |
SAVECFG RESTORECFG | Save network configuration Restore saved network configuration |
SHOW SHOWNICIDS | ipconfig /all view Shows generated NICIDs.lst file |
GUI | diagnostics GUI |
As an added bonus, the bundled SandRW.exe is a very handy, command-line text search and replace utility. I use devcon.exe to extract out the hardware IDs of the network interfaces, then use SandRW.exe to massage the output to a delimited format that NETSHX.CMD can use. Here's the snippet of the code used in netshx.cmd:
devcon hwids =net>%temp%\devcon.tmp
sandrw %temp%\devcon.tmp "{CRLF} Name: " ' NICIDS: "' QUIET
sandrw %temp%\devcon.tmp "{CRLF} Hardware ID's:{CRLF} " '" HWIDS: ' QUIET
type %temp%\devcon.tmp | find "IDS: ">%~d0%~p0NICIDs.lst
sandrw %~d0%~p0NICIDs.lst ' HWIDS: "' '" HWIDS: "' QUIET
Which turns this file:
PCI\VEN_8086&DEV_1031&SUBSYS_C007144D&REV_42\4&139E449D&0&40F0
Name: Intel(R) PRO/100 VE Network Connection #2
Hardware ID's:
PCI\VEN_8086&DEV_1031&SUBSYS_C007144D&REV_42
PCI\VEN_8086&DEV_1031&SUBSYS_C007144D
PCI\VEN_8086&DEV_1031&CC_020000
PCI\VEN_8086&DEV_1031&CC_0200
Compatible ID's:
PCI\VEN_8086&DEV_1031&REV_42
PCI\VEN_8086&DEV_1031
PCI\VEN_8086&CC_020000
PCI\VEN_8086&CC_0200
PCI\VEN_8086
PCI\CC_020000
PCI\CC_0200
PCMCIA\LUCENT_TECHNOLOGIES-WAVELAN/IEEE-911F\1
Name: ORiNOCO Mini PCI Card
Hardware ID's:
PCMCIA\Lucent_Technologies-WaveLAN/IEEE-911F
PCMCIA\Lucent_Technologies-WaveLAN/IEEE-0156-0002
PCMCIA\Lucent_Technologies-0156-0002
ROOT\MS_L2TPMINIPORT\0000
Name: WAN Miniport (L2TP)
Hardware ID's:
ms_l2tpminiport
ROOT\MS_NDISWANBH\0000
Name: WAN Miniport (Network Monitor)
Hardware ID's:
ms_ndiswanbh
ROOT\MS_NDISWANIP\0000
Name: WAN Miniport (IP)
Hardware ID's:
ms_ndiswanip
ROOT\MS_PPPOEMINIPORT\0000
Name: WAN Miniport (PPPOE)
Hardware ID's:
ms_pppoeminiport
ROOT\MS_PPTPMINIPORT\0000
Name: WAN Miniport (PPTP)
Hardware ID's:
ms_pptpminiport
ROOT\MS_PSCHEDMP\0000
Name: AMD PCNET Family PCI Ethernet Adapter - Packet Scheduler Miniport
Hardware ID's:
ms_pschedmp
ROOT\MS_PSCHEDMP\0001
Name: WAN Miniport (IP) - Packet Scheduler Miniport
Hardware ID's:
ms_pschedmp
ROOT\MS_PSCHEDMP\0002
Name: Intel(R) PRO/100 VE Network Connection - Packet Scheduler Miniport
Hardware ID's:
ms_pschedmp
ROOT\MS_PSCHEDMP\0003
Name: ORiNOCO Mini PCI Card - Packet Scheduler Miniport
Hardware ID's:
ms_pschedmp
ROOT\MS_PSCHEDMP\0004
Name: AMD PCNET Family PCI Ethernet Adapter #2 - Packet Scheduler Miniport
Hardware ID's:
ms_pschedmp
ROOT\MS_PSCHEDMP\0005
Name: Intel(R) PRO/100 VE Network Connection #2 - Packet Scheduler Miniport
Hardware ID's:
ms_pschedmp
ROOT\MS_PSCHEDMP\0006
Name: AMD PCNET Family PCI Ethernet Adapter #3 - Packet Scheduler Miniport
Hardware ID's:
ms_pschedmp
ROOT\MS_PSCHEDMP\0007
Name: ORiNOCO 802.11abg ComboCard Gold - Packet Scheduler Miniport
Hardware ID's:
ms_pschedmp
ROOT\MS_PSCHEDMP\0008
Name: WAN Miniport (Network Monitor) - Packet Scheduler Miniport
Hardware ID's:
ms_pschedmp
ROOT\MS_PTIMINIPORT\0000
Name: Direct Parallel
Hardware ID's:
ms_ptiminiport
ROOT\VMWARE\0000
Name: VMware Virtual Ethernet Adapter for VMnet1
Hardware ID's:
*VMnetAdapter1
ROOT\VMWARE\0001
Name: VMware Virtual Ethernet Adapter for VMnet8
Hardware ID's:
*VMnetAdapter8
V1394\NIC1394\8001E7DF041
Name: 1394 Net Adapter #2
Hardware ID's:
V1394\NIC1394
Compatible ID's:
V1394\NIC1394
20 matching device(s) found.
into this file:
PCI\VEN_8086&DEV_1019&SUBSYS_303B8086&REV_00\4&350EE48D&0&0818 NICIDS: "Intel(R) PRO/1000 CT Network Connection" HWIDS: PCI\VEN_8086&DEV_1019&SUBSYS_303B8086&REV_00
ROOT\MS_L2TPMINIPORT\0000 NICIDS: "WAN Miniport (L2TP)" HWIDS: ms_l2tpminiport
ROOT\MS_NDISWANIP\0000 NICIDS: "WAN Miniport (IP)" HWIDS: ms_ndiswanip
ROOT\MS_PPPOEMINIPORT\0000 NICIDS: "WAN Miniport (PPPOE)" HWIDS: ms_pppoeminiport
ROOT\MS_PPTPMINIPORT\0000 NICIDS: "WAN Miniport (PPTP)" HWIDS: ms_pptpminiport
ROOT\MS_PSCHEDMP\0000 NICIDS: "Intel(R) PRO/1000 CT Network Connection - Packet Scheduler Miniport" HWIDS: ms_pschedmp
ROOT\MS_PSCHEDMP\0001 NICIDS: "WAN Miniport (IP) - Packet Scheduler Miniport" HWIDS: ms_pschedmp
ROOT\MS_PTIMINIPORT\0000 NICIDS: "Direct Parallel" HWIDS: ms_ptiminiport
ROOT\VMWARE\0000 NICIDS: "VMware Virtual Ethernet Adapter for VMnet1" HWIDS: *VMnetAdapter1
ROOT\VMWARE\0001 NICIDS: "VMware Virtual Ethernet Adapter for VMnet8" HWIDS: *VMnetAdapter8
SYNTAX: Sandrw FileName (Search_String | FILE) (Replace_String | CSV_FileName) (param3=Case sensitive) (QUIET)
The 'FILE' option lets you specify a CSV file specifying search and replace parameters
Special characters: {CRLF}, {LF}, {TAB}, {PIPE}
9-6-06 UPDATE:
NETSHX has been updated to accept either the Interface name or the Device Name, or a unique partial string of either. It's best if you rename the Interface names to a short, easy-to-type name with no spaces. So, for example, instead of:
Rename it to something like this: