Followers

How to Use the Netsh.exe Tool and Command-Line Switches



You can use the Netsh.exe tool to perform the following tasks:
  • Configure interfaces.
  • Configure routing protocols.
  • Configure filters.
  • Configure routes.
  • Configure remote access behavior for Windows-based remote access routers that are running the Routing and Remote Access Server (RRAS) Service.
  • Display the configuration of a currently running router on any computer.
  • Use the scripting feature to run a collection of commands in batch mode against a specified router.
The syntax for the Netsh.exe tool is:
netsh [-r router name] [-a AliasFile] [-c Context] [Command | -f ScriptFile]
To display a list of subcontexts and commands that can be used in a context, type the context name followed by a space and a ? at the netsh> command prompt. For example, to display a list of subcontext and commands that can be used in the /routing context, type routing ? at the netsh> command prompt, and then press ENTER.

Contexts
Context strings are appended to the Netsh.exe tool command and are passed to an associated helper. The helper may have one or more entry points that map to contexts. Some of the contexts available in the Netsh.exe tool are:

Context Command: /dhcp
Result: Changes to the Dynamic Host Configuration Protocol (DHCP) context.

Context Command: /ras
Result: Changes to the Remote Access Server (RAS) context.

Context Command: /routing
Result: Changes to the routing context.

Context Command: /wins
Result: Changes to the Windows Internet Name Service (WINS) context.

Contexts may also nest within other contexts. For example, the following contexts operate within the netsh>ras context:

Context Command: /ip
Result: Changes to the Internet Protocol (IP) context.

Context Command: /ipx
Result: Changes to the Internetwork Packet Exchange (IPX) context.

Context Command: /netbeui
Result: Changes to the NetBios Enhanced User Interface (NETBEUI) context.

The following subcontexts operate within the netsh>routing ip context:

Context Command: /autodhcp
Result: Changes to the autodhcp subcontext.

Context Command: /dnsproxy
Result: Changes to the dnsproxy subcontext.

Context Command: /igmp
Result: Changes to the Internet Group Membership Protocol (IGMP) subcontext.

Context Command: /mib
Result: Changes to the Management Information Base (MIB) subcontext.

Context Command: /nat
Result: Changes to the Network Address Translation (NAT) subcontext.

Context Command: /ospf
Result: Changes to the Open Shortest Path First (OSPF) subcontext.

Context Command: /relay
Result: Changes to the relay subcontext.

Context Command: /rip
Result: Changes to the Routing Information Protocol (RIP) subcontext.


Netsh.exe Commands
The following additional commands can be used with the Netsh.exe tool:

NOTE: Optional parameters are shown in brackets ([ ]). Alternative entries are shown with a pipe (|) character between them.

Context Command: /?
Result: Displays help.

Context Command: /abort
Result: Discards any changes made in offline mode. No effect in online mode.

Context Command: /add helper DLL-name
Result: Installs the helper .dll file in netsh.exe.

Context Command: /alias [alias-name] [string1] [string2 ...]
Result: If /alias, lists all aliases. If /alias alias-name, displays the equivalent string. If /alias alias-name string1 string2 ..., sets alias-name to the specified strings.

Context Command: /bye
Result: Exits the program.

Context Command: /commit
Result: Commits any changes made in the offline mode to the router. No effect in the online mode.

Context Command: /delete helper .dll file name
Result: Removes the helper .dll file from Netsh.exe.

Context Command: /dump -file name
Result: Dumps or appends configuration to a text file.

Context Command: /exec script file name
Result: Loads the script file and executes commands from it.

Context Command: /exit
Result: Exits the program.

Context Command: /h
Result: Displays help.

Context Command: /help
Result: Displays help.

Context Command: /offline
Result: Sets the current mode to offline. Any changes made in this mode are saved, but require a "commit" or "online" command to be set in the router.

Context Command: /online
Result: Sets the current mode to online. Any changes in this mode are immediately reflected in the router.

Context Command: /popd
Result: Pops a context from the stack.

Context Command: /pushd
Result: Pushes current context onto the stack.

Context Command: /quit
Result: Exits the program.

Context Command: /set mode [mode =] online | offline
Result: Sets the current mode to online or offline.

Context Command: /show alias | helper | mode
Result: If /show alias, lists all defined aliases. If /show helper, lists all top-level helpers. If /show mode, shows the current mode.

Context Command: /unalias alias name
Result: Deletes the specified alias.

Helper Dynamic Link Libraries Files Available
Routing & Remote Access IP Configuration - Ipmontr.dll
Routing & Remote Access IPX Configuration - Ipxmontr.dll
Interface - Ifmon.dll
RAS - Rasmontr.dll
DHCP - Dhcpmon.dll
WINS - Winsmon.dll 

Associated Registry Entries for Helper Dynamic Link Libraries Files
HKEY_LOCAL_MACHINE/Software/Microsoft/NetSh/
REG_SZ: Ipmontr.dll
REG_SZ: Ipxmontr.dll
REG_SZ: Ifmon.dll
REG_SZ: Rasmontr.dll
REG_SZ: Dhcpmon.dll
REG_SZ: Winsmon.dll

Published By
S.G.Godwin Dinesh.MCA
Sr.System Administrator

No comments:

Post a Comment