netsh


netsh

Configures networking services from the command line.

Description

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:

Global commands

These can be run within any context and provide general functionality to the shell.

Context-specific commands

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:

AAAA

Configures the AAAA component that is used by both Routing and Remote Access and Internet Authentication Service

DHCP

Configures DHCP servers

Server

Subcontext for configuring a specific DHCP server

Interface

Configures demand-dial interfaces

IP

Subcontext for configuring IP demand-dial interfaces

RAS

Configures remote-access servers

IP, IPX, NETBEUI, Appletalk, AAAA

Possible subcontexts for configuring RAS

Routing

Configures IP and IPX routing

IP, IPX

Possible subcontexts for configuring routing

WINS

Configures WINS servers

NetShell can be run in two command modes:

Interactive (online) mode

Commands typed at the NetShell prompt ( netsh> ) are executed immediately.

Batch (offline) mode

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 ).

Syntax

 netsh [-a   Aliasfile   ] [-c   Context   ] [-r   RemoteComputer   ] [   command   -f   Scriptfile   ] 

Options

-a Aliasfile

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).

-c Context

Opens the NetShell shell and switches immediately to the specified context.

-r RemoteComputer

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.

command

Specifies any NetShell global command to be executed immediately (see the following " Examples " section).

-f Scriptfile

Runs the NetShell commands found in the file Scriptfile (include path ).

Examples

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:\> 


Windows Server 2003 in a Nutshell
Windows Server 2003 in a Nutshell
ISBN: 0596004044
EAN: 2147483647
Year: 2003
Pages: 415
Authors: Mitch Tulloch

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net