Netsh Commands for Wired Local Area Network (lan)

The Windows Vista™ Netsh commands for wired local area network (LAN) provide methods to configure connectivity and security settings. You can use the Netsh lan commands to configure the local computer, or to configure multiple computers by using a logon script. You can also use the netsh lan commands to view wired 802.1X Group Policy and to administer user wired 802.1X settings.

The wired Netsh command line provides easier secure wired deployment: Provides an alternative to Windows Server® Code Name "Longhorn" Group Policy to configure wired connectivity and security settings.

Netsh LAN Commands for Wired Interface

You can run these commands from the Windows Vista command prompt by switching to the lan context using the following instructions.

Entering the netsh lan context

To enter the netsh context for lan
1. 

Click Start, click Run, type cmd, and then click OK, to open a command prompt.

2. 

At the command prompt, type netsh and press Enter, then type lan and press Enter.

Formatting legend

Format Meaning

Italic

Information that the user must supply.

Bold

Elements that the user must type exactly as shown.

Ellipsis (…)

Parameter that can be repeated several times in a command line.

Between brackets([])

Optional items

Between braces ({}); choices separated by pipe (|).

Example: {even|odd}

Set of choices from which the user must choose only one.

Commands in the netsh lan context

The following command is available in this context:

  • Netsh command "?" - Displays a list of commands or parameters.
  • add - Adds a profile to the specified interface on the computer.
  • delete - Removes a LAN profile from the specified interface on the computer.
  • dump - Generates and saves a script that contains the current configuration.
  • export - Saves LAN profiles as XML files to a specified location.
  • help - Displays a list of commands.
  • reconnect - Reconnects to the network using the specified adapter.
  • set - Sets wired configuration.
  • show - Displays information.

Netsh command "?"

Displays a list of commands or parameters

Syntax:

CommandName/?

Parameters:

There are no parameters associated with this command.

Remarks:

Displays a list of commands or parameters.

Example command:

  • ?
  • add /?
  • delete profile /?

Description:

The example command, ?, displays the entire list of contexts supported by netsh.

The example command, add /?, displays a list of commands within the add command.

The example command, delete profile /?, displays a list of parameters for the delete profile command.

add

Adds a LAN profile to the specified interface on the computer.

add profile

Add a LAN profile to the specified interface on the computer

Syntax:

add profile filename=PathAndProfileNameinterface= InterfaceName

Parameters:

filename

Required. Specifies the path and name of the XML file containing the profile data.

interface

Required. Specifies the name of the interface on which the profile will be set.

Remarks:

The interface parameter specifies one of the interface names shown by the netsh lan show interface command. The profile will be added to the specified interface. There is wildcard support for this parameter. You can use the characters ? and * to replace a letter and letters of the interface name, respectively.

Example command:

  • add profile filename=C:\Users\WiredUser\Documents\"profile1.xml" interface="Local Area Connection"

delete

Deletes a profile from the wired 802.1X profile store.

delete profile

Removes a LAN profile from one or multiple interfaces.

Syntax:

delete profile interface=InterfaceName

Parameters:

interface

Required. Specifies the name of the interface on which the profile is to be deleted.

Remarks:

There is wildcard support for the interface parameter. You can use the characters ? and * to replace a letter and letters of the interface name, respectively.

Example command:

  • delete profile interface="Local Area Connection"
  • delete profile interface = “i*”

dump

Generates and saves a script that contains the current configuration to the specified location

Syntax:

dump >PathAndFileName

Parameters:

There are no parameters associated with this command.

Remarks:

Creates a script that contains the current configuration, which can be used to restore altered configuration settings.

Example command:

  • dump >c:\lanconfig.txt

export

Saves LAN profiles as XML files to the specified location

export profile

Syntax:

export profile folder=PathAndFileName [[interface=]InterfaceName]

Parameters

folder

Required. Specifies the path and file name for the profile XML file.

interface

Optional. Specifies the name of the interface on which the profile is configured.

Remarks:

The folder parameter must specify an existing folder that is accessible from the local computer. It can be either an absolute path or relative path to the current working directory. In addition, "." refers to the current working directory, and ".." refers to the parent directory of the current working directory. The folder name cannot be a Universal Naming Convention (UNC) path.

If the interface parameter is specified, only the specified profile associated with that interface is saved. Otherwise all profiles on the computer with the specified name are saved.

Profiles of specified interfaces are saved in the format "InterfaceName ProfileName.xml." Profiles at the computer level are saved in the file name format "ProfileName.xml."

There is wildcard support for this parameter. You can use the characters ? and * to replace a letter and letters of the interface name, respectively.

Example command:

  • export profile folder=c:\Users\user\Documents\ interface="Local Area Connection"
  • export profile folder=c:\Users\user\Documents\

help

Displays a list of commands or parameters

Syntax:

CommandNamehelp

Parameters:

There are no parameters associated with this command.

Remarks:

Displays a list of commands or parameters for the specified command

Example command:

  • add filter help
  • delete profile help

reconnect

Attempts to reauthenticate to a wired network by using the specified interface

Syntax:

reconnect[[interface=]InterfaceName]

Parameters:

interface

Optional. Specifies the interface that is used for the connection attempt.

Remarks:

If the interface parameter is specified, only that interface attempts to reconnect. If the interface parameter is not specified, all interfaces attempt to reconnect. Wildcard (*) names cannot be used to specify the interface name.

Example commands:

  • reconnect interface="Local Area Connection"

set

Sets the configuration on interfaces. The following commands are available in this context:

  • set autoconfig - Enable or disable Wired AutoConfig Service on an interface.
  • set tracing - Enable or disable tracing.
set autoconfig

Enables or disables Wired AutoConfig Service on an interface

Syntax:

set autoconfig enabled={yes|no}interface= InterfaceName

Parameters:

enabled {yes | no}

Required. Specifies whether to set Wired AutoConfig Service to enabled or disabled.

interface

Required. Specifies the name of the interface on which the service is enabled or disabled.

Remarks:

When autoconfig is enabled, Windows Windows Vista automatically connects to the network by using the specified interface. By default, autoconfig is enabled.

If autoconfig is disabled, Windows will not automatically connect to any networks by using the specified interface.

There is wildcard support for the interface parameter. You can use the characters ? and * to replace a letter and letters of the interface name, respectively.

Example command:

  • Set autoconfig enabled=yes interface="Local Area Connection1"
set tracing

Enables or disables tracing

Syntax:

set tracing [[mode=]{yes|no| persistent}]

Parameters:

mode {yes | no | persistent}

Required. Specifies whether tracing is disabled, enabled and persistent, or enabled and nonpersistent. See "Remarks" for additional information.

Remarks:

  • If the mode parameter is set to yes, nonpersistent tracing is active until the mode is either set to no or the computer is restarted.
  • If the mode parameter is set to no, tracing is stopped for either persistent or nonpersistent tracing.
  • If the mode parameter is set to persistent, tracing will still be active even after the computer is restarted.

The default value for the mode parameter is nonpersistent.

Example command:

  • set tracing mode=persistent

 

Note

For Windows Vista Beta 2, and Windows Vista Beta 1, the “set tracing” command syntax is:

set tracing enabled={yes|no} [[mode=]{persistent|nonpersistent}]

The enabled parameter is required. The mode parameter is optional. If the mode parameter is set to persistent, trace logs are always generated until the enabled parameter is set to no.

The default value for the mode parameter is nonpersistent.

show

Displays information. The following commands are available in this context:

  • show interfaces - Displays a list of the current wired interfaces on the computer.
  • show profiles - Displays a list of wired profiles that are configured on the computer.
  • show settings - Displays the current global settings of the wired LAN.
  • show tracing - Displays whether wired tracing is enabled or disabled.
show interfaces

Displays a list of the current wired interfaces on the computer

Syntax:

show interfaces

Parameters:

There are no parameters for this command.

Remarks:

Shows the wired interfaces configured on the computer.

Displayed information includes:

  • The number of interfaces on the computer
  • Name
  • Description
  • GUID
  • Ethernet address
  • State [network authentication support (yes or no)]

Example command:

  • showinterfaces
show profiles

Displays a list of wired profiles that are configured on the computer

Syntax:

show profiles[[interface=]InterfaceName]

Parameters:

interface

Optional. Specifies the name of the interface which has this profile configured. See "Remarks."

Remarks:

If the interface parameter is specified, then only the contents of the profile for the specified interface is displayed. Otherwise all profiles will be displayed with their name and description.

Example commands:

  • show profiles interface="Local Area Connection"
  • show profiles
show settings

Displays the current global settings of the wired LAN

Syntax:

show settings

Parameters:

There are no parameters for this command.

Remarks:

Shows whether or not auto-configuration is enabled on each interface.

Example command:

  • show settings
show tracing

Displays whether wired tracing is enabled or disabled

Syntax:

show tracing

Parameters:

There are no parameters for this command.

Remarks:

Displayed information includes:

  • Tracing state (enabled or disabled)
  • Tracing persistence state (running or not running)
  • Trace log file location (for example, "c:\Windows\system32\logfiles\WiredAutoLog\"

Example command:

  • show tracing
Top of page Top of page