Netsh command

Updated: 11/12/2023 by Computer Hope
netsh command

Netsh is an MS-DOS command that enables users to change network settings. For example. users may switch their network device from a dynamic address to a static address or changing the IP address.

Availability

Netsh is an external command accessed through C:\Winnt\System32 directory and is available for the following Microsoft operating systems as netsh.exe.

Netsh syntax

Windows Vista and later syntax

netsh [-a AliasFile] [-c Context] [-r RemoteMachine] [-u [DomainName\]UserName] [-p Password | *] [Command | -f ScriptFile]

The following commands are available:

? Displays a list of commands.
add Adds a configuration entry to a list of entries.

add helper Installs a helper DLL.
advfirewall

Changes to the 'netsh advfirewall' context.

consec Changes to the 'netsh advfirewall consec' context.
dump Displays a configuration script.
export Exports the current policy to a file.
firewall Changes to the 'netsh advfirewall firewall' context.
help Displays a list of commands.
import Imports a policy file into the current policy store.
mainmode Changes to the 'netsh advfirewall mainmode' context.
monitor Changes to the 'netsh advfirewall monitor' context.
reset Resets the policy to the default out-of-box policy.
set Sets the per-profile or global settings.
show Displays profile or global properties.
branchcache

Changes to the 'netsh branchcache' context.

dump Displays a configuration script.
exportkey Exports the content information key.
flush Flushes the contents of the cache.
help Displays a list of commands.
importkey Imports a new content information key.
reset Resets the BranchCache service.
set Sets configuration parameters.
show Displays configuration parameters.
smb Changes to the 'netsh branchcache smb' context.
bridge

Changes to the 'netsh bridge' context.

dump Displays a configuration script.
help Displays a list of commands.
install Installs the component corresponding to the current context.
set Sets configuration information.
show Displays information.
uninstall Removes the component corresponding to the current context.
delete Deletes a configuration entry from a list of entries.

delete helper Deletes a helper DLL.
dhcpclient

Changes to the 'netsh dhcpclient' context.

list Lists all the commands available.
help Displays help.
trace Enable or disable tracing for DHCP client and DHCP QEC, dump the last 100 traces.
dnsclient

Changes to the 'netsh dnsclient' context.

add Adds a configuration entry to a table.
delete Deletes a configuration entry from a table.
dump Displays a configuration script.
help Displays a list of commands.
set Sets configuration information.
show Displays information.
dump Displays a configuration script.
exec Runs a script file.
firewall Changes to the 'netsh firewall' context.

add Adds firewall configuration.
delete Deletes firewall configuration.
dump Displays a configuration script.
help Displays a list of commands.
set Sets firewall configuration.
show Shows firewall configuration.
help Displays a list of commands.
http Changes to the 'netsh http' context.

add Adds a configuration entry to a table.
delete Deletes a configuration entry from a table.
dump Displays a configuration script.
flush Flushes internal data.
help Displays a list of commands.
show Displays information.
interface Changes to the 'interface' context.

6to4 Changes to the 'netsh interface 6to4' context.
dump Displays a configuration script.
help Displays a list of commands.
httpstunnel Changes to the 'netsh interface httpstunnel' context.
ipv4 Changes to the 'netsh interface ipv4' context.
ipv6 Changes to the 'netsh interface ipv6' context.
isatap Changes to the 'netsh interface isatap' context.
portproxy Changes to the 'netsh interface portproxy' context.
set Sets configuration information.
show Displays information.
tcp Changes to the 'netsh interface tcp' context.
teredo Changes to the 'netsh interface teredo' context.
ipsec Changes to the 'netsh ipsec' context.

dump Displays a configuration script.
dynamic Changes to the 'netsh ipsec dynamic' context.
help Displays a list of commands.
static Changes to the 'netsh ipsec static' context.
lan Changes to the 'netsh lan' context.

add Adds a configuration entry to a table.
delete Deletes a configuration entry from a table.
dump Displays a configuration script.
export Saves LAN profiles to XML files.
help Displays a list of commands.
reconnect Reconnects on an interface.
set Configures settings on interfaces.
show Displays information.
mbn Changes to the 'netsh mbn' context.

add Adds a configuration entry to a table.
connect Connects to a mobile broadband network.
delete Deletes a configuration entry from a table.
disconnect Disconnects from a mobile broadband network.
dump Displays a configuration script.
help Displays a list of commands.
set Sets configuration information.
show Displays information.
namespace Changes to the 'netsh namespace' context.

dump Displays a configuration script.
help Displays a list of commands.
show Displays information.
nap Changes to the 'netsh nap' context.

client Changes to the 'netsh nap client' context.
dump Displays a configuration script.
help Displays a list of commands.
hra Changes to the 'netsh nap hra' context.
reset Resets configuration.
show Shows configuration and state information.
netio Changes to the 'netsh netio' context.

add Adds a configuration entry to a table.
delete Deletes a configuration entry from a table.
dump Displays a configuration script.
help Displays a list of commands.
show Displays information.
p2p Changes to the 'netsh p2p' context.

dump Displays a configuration script.
group Changes to the 'netsh p2p group' context.
help Displays a list of commands.
idmgr Changes to the 'netsh p2p idmgr' context.
pnrp Changes to the 'netsh p2p pnrp' context.
ras Changes to the 'ras' context.

aaaa Changes to the 'netsh ras aaaa' context.
add Adds items to a table.
delete Removes items from a table.
diagnostics Changes to the 'netsh ras diagnostics' context.
dump Displays a configuration script.
help Displays a list of commands.
ip Changes to the 'netsh ras ip' context.
ipv6 Changes to the 'netsh ras ipv6' context.
set Sets configuration information.
show Displays information.
rpc Changes to the 'netsh rpc' context.

add Creates an Add list of subnets.
delete Creates a Delete list of subnets.
dump Displays a configuration script.
filter Changes to the 'netsh rpc filter' context.
help Displays a list of commands.
reset Resets the selective binding settings to 'none' (listen on all interfaces).
show Displays the selective binding state for each subnet on the system.
set Updates configuration settings.

machine Sets the current machine on which to operate.
show Displays information.

show alias Lists all defined aliases.
show helper Lists all the top-level helpers.
trace Changes to the 'netsh trace' context.

convert Converts a trace file to an HTML report.
correlate Normalizes or filters a trace file to a new output file.
diagnose Start a diagnose session.
dump Displays a configuration script.
help Displays a list of commands.
merge Merges trace files and adds symbols metadata.
show List interfaces, providers, and tracing state.
start Starts tracing.
stop Stops tracing.
wcn Changes to the 'netsh wcn' context.

dump Displays a configuration script.
enroll Connects to a wireless network.
help Displays a list of commands.
query Queries information about a WCN device.
wfp Changes to the 'netsh wfp' context.

capture Displays a list of commands.
dump Displays a configuration script.
help Displays a list of commands.
set Sets WFP diagnostic options.
show Show WFP configuration and state.
winhttp Changes to the 'netsh winhttp' context.

dump Displays a configuration script.
help Displays a list of commands.
import Imports WinHTTP proxy settings.
reset Resets WinHTTP settings.
set Configures WinHTTP settings.
show Displays currents settings.
winsock Changes to the 'netsh winsock' context.

audit Displays a list of Winsock LSPs that are installed and removed.
dump Displays a configuration script.
help Displays a list of commands.
remove Removes a Winsock LSP from the system.
reset Resets the Winsock Catalog to a clean state.
set Sets Winsock options.
show

Displays information.

wlan Changes to the 'netsh wlan' context.

add Adds a configuration entry to a table.
connect Connects to a wireless network.
delete Deletes a configuration entry from a table.
disconnect Disconnects from a wireless network.
dump Displays a configuration script.
export Saves WLAN profiles to XML files.
help Displays a list of commands.
refresh Refresh hosted network settings.
reportissues Generate WLAN smart trace report.
set Sets configuration information.
show Displays information.
start Start hosted network.
stop Stop hosted network.

Windows XP and earlier syntax

netsh [-a AliasFile] [-c Context] [-r RemoteMachine] [Command | -f ScriptFile]
? Displays a list of commands.
add Adds a configuration entry to a list of entries.

add helper Installs a helper DLL.
delete Deletes a configuration entry from a list of entries.

delete helper Deletes a helper DLL.
dump Displays a configuration script.
exec Runs a script file.
help Displays a list of commands.
interface Changes to the 'interface' context.

ip Changes the 'interface ip' context.
ras Changes to the 'ras' context.

aaaa Changes to the 'ras aaaa' context.
appletalk Changes to the 'ras appletalk' context.
ip Changes the 'ras ip' context.
ipx Changes to the 'ras ipx' context.
netbeui Changes to the 'ras netbeui' context.
routing Changes to the 'routing' context.

ip Change to the 'routing ip' context.
ipx Changes to the 'routing ipx' context.
set Updates configuration settings.

machine Sets the current machine on which to operate.
show Displays information.

show alias Lists all defined aliases.
show helper Lists all the top-level helpers.

Available commands after you have entered the netsh command (typing netsh at the prompt and pressing Enter).

.. Goes up one context level.
? Displays a list of commands.
abort Discards changes made while in offline mode.
add Adds a configuration entry to a list of entries.
alias Adds an alias.
bye Exits the program.
commit Commits changes made while in offline mode.
delete Deletes a configuration entry from a list of entries.
dump Displays a configuration script.
exec Runs a script file.
exit Exits the program.
help Displays a list of commands.
interface Changes to the 'interface' context.
offline Sets the current mode to offline.
online Sets the current mode to online.
popd Pops a context from the stack.
pushd Pushes current context on stack.
quit Exits the program.
ras Changes to the 'ras' context.
routing Changes to the 'routing' context.
set Updates configuration settings.
show Displays information.
unalias Deletes an alias.

Netsh examples

netsh

Enter the netsh command.

netsh dump

Dump all the network information as a script to the screen. Can also be sent to a file by doing netsh dump > file.txt at the prompt. This script can then be executed using the exec command.

set address name="Local Area Connection" source=dhcp

Set the "Local Area Connection" to DHCP.

set address local static 10.0.0.9 255.0.0.0 10.0.0.1 1

Set the local address to static address.

netsh interface ip show config

View network IP configuration. Below is an example of what may be seen.

Configuration for interface "Local Area Connection"
DHCP enabled: Yes
InterfaceMetric: 1
DNS servers configured through DHCP
WINS servers configured through DHCP