Netsh
The NetShell utility (netsh) is a command-line, scripting interface for configuring and monitoring Windows 2000. The configuration tool provides an interactive shell interface to the user. The front end is the command shell that accepts your commands, and the back end is a helper that corresponds to a system component or utility. A helper is a Dynamic Link Library file (.dll) that extends the functionality of netsh. A helper provides configuration and/or monitoring support for one or more services, utilities, or protocols, but helpers can also be used to extend other helpers. The command shell directs the command to the appropriate helper, and the helper carries out the command.
The netsh command allows you to run the NetShell utility to display or modify the configuration of a currently running computer. It also provides a scripting feature that you can use to run a collection of commands in batch mode against a specified computer.
Contexts
The command shell provides for contexts, which are groupings of netsh commands for specific networking components. A context is identified by a string that is appended to commands. Commands entered in a given context are passed to an associated helper. The contexts available depend on the Windows 2000 components installed. For example, typing routing at the netsh command changes to the routing context. Typing ras at the netsh command changes to the ras (remote access portion of the Routing and Remote Access service) context.
Subcontexts may exist within each context. For example, within the routing context, you can change to the ip and ipx subcontexts.
netsh [-r RemoteComputer] [-a AliasFile] [-c Context] [Command | -f ScriptFile]
To display a list of subcontexts and commands that can be used in a context, at the netsh prompt, type the context name, followed by a space and ?. For example, to display a list of subcontexts and commands that can be used in the routing context, at the netsh prompt, type the following:
netsh>routing ?
Netsh Commands
As well as the context commands shown above, the following additional commands can be used with Netsh. Optional parameters are shown in brackets ([ ]). Alternative entries are shown with a pipe (|) between them.
Command | Result |
---|---|
? | Displays help. |
abort | Discards any changes made in offline mode. No effect in online mode. |
add helper DLL-name | Installs the helper DLL in netsh. |
alias [alias-name] [string1] [string2 …] |
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. |
bye | Exits the program. |
commit | Commits any changes made in the offline mode to the router. No effect in the online mode. |
delete helper DLL-name | Removes the helper DLL from netsh. |
dump -file-name | Dumps or appends configuration to a text file. |
exec Script-file-name | Loads the script file and executes commands from it. |
exit | Exits the program. |
h | Displays help. |
help | Displays help. |
offline | Sets the current mode to offline. Any changes made in this mode will be saved, but require a commit or online command to be set in the router. |
online | Sets the current mode to online. Any changes in this mode will be immediately reflected in the router. |
popd | Pops a context from the stack. |
pushd | Pushes current context onto the stack. |
quit | Exits the program |
set mode [mode =] online | offline | Sets the current mode to online or offline. |
show alias | helper | mode |
If show alias, lists all defined aliases. If show helper, lists all top-level helpers. If show mode, shows the current mode. |
unalias alias-name | Deletes the specified alias. |
Notice: Windows® 95, Windows® 98, Windows® NT, Windows® 2000 and
Microsoft® Office are registered trademarks or trademarks of the Microsoft Corporation.