netsh |
Configures networking services from the command line.
This group of commands enables command-line administration of networking services such as DHCP, DNS, Routing and Remote Access, and WINS. NetShell ( netsh.exe ) is a command-line scripting tool that can administer these services on local or remote computers in both interactive and batch mode. It provides a shell from which you can enter different contexts for administering each service. Contexts are provided by helper DLLs, which extend NetShell's functionality by providing service-specific command sets. Some contexts have subcontexts as well, which are described in the following entries.
NetShell supports two kinds of commands:
These can be run within any context and provide general functionality to the shell.
These are commands specific to a given context (see later in this section and in the following entries).
The various contexts and subcontexts currently supported by NetShell include the following:
Configures the AAAA component that is used by both Routing and Remote Access and Internet Authentication Service
Configures DHCP servers
Subcontext for configuring a specific DHCP server
Configures demand-dial interfaces
Subcontext for configuring IP demand-dial interfaces
Configures remote-access servers
Possible subcontexts for configuring RAS
Configures IP and IPX routing
Possible subcontexts for configuring routing
Configures WINS servers
NetShell can be run in two command modes:
Commands typed at the NetShell prompt ( netsh> ) are executed immediately.
Commands typed at the NetShell prompt are collected and then run as a batch job using the commit command. Note that this is only for router-configuration commands in the routing context.
In addition, you can create a text file containing a script of NetShell commands and then run the script using the -f switch or exec command (see netsh--Global Context ).
netsh [-a Aliasfile ] [-c Context ] [-r RemoteComputer ] [ command -f Scriptfile ]
Specifies an alias file to use. It is a file containing a list of NetShell commands together with an alias to allow the commands to be used by just typing the alias name (useful for mapping commands on other platforms, such as Unix, to specific NetShell commands).
Opens the NetShell shell and switches immediately to the specified context.
Specifies the remote computer on which NetShell commands are to be executed. The computer can be specified using its computer name (NetBIOS or DNS name) or IP address. If this option is omitted, the commands are executed on the local computer.
Specifies any NetShell global command to be executed immediately (see the following " Examples " section).
Runs the NetShell commands found in the file Scriptfile (include path ).
Open the NetShell shell:
C:\> netsh netsh>
Open the NetShell shell in the DHCP context to configure DHCP interactively:
C:\> netsh -c dhcp dhcp>
Open the NetShell shell, switch to the IP subcontext of the Interface context, obtain IP address information about the network interface, and return to the command shell:
C:\> netsh -r 172.16.11.104 -c interface ip show address Configuration for interface "Local Area Connection" DHCP enabled: No IP Address: 172.16.11.104 SubnetMask: 255.255.255.0 Default Gateway: 172.16.11.196 GatewayMetric: 1 InterfaceMetric: 1 C:\>