Skip to content

NETSH Windows Command Guide

The Windows netsh command is a powerful tool for managing network settings, troubleshooting connectivity issues, and configuring network interfaces efficiently. With netsh, you can view or change the network configuration of your computer, set parameters such as IP addresses and DNS servers, and diagnose and resolve network problems. This command-line utility provides a wide range of functionalities for networking tasks, making it an essential tool for network administrators and advanced users.

NETSH Syntax:

Terminal window
netsh [command] [subcommand] [options] [parameters]

Options:

OptionDescription
/?Displays help for the specified command.

Parameters:

No specific parameters for the general netsh command.

NETSH Command Samples:

Show Interface Information

Terminal window
netsh interface show interface

Displays information about all network interfaces on the system.

Disable a Network Adapter

Terminal window
netsh interface set interface "Ethernet" admin=disable

Disables the network adapter named “Ethernet”.

View Wireless Networks

Terminal window
netsh wlan show networks

Shows a list of available wireless networks.

Change IP Address

Terminal window
netsh interface ipv4 set address "Ethernet" static 192.168.1.100 255.255.255.0 192.168.1.1

Sets a static IP address, subnet mask, and default gateway for the network adapter named “Ethernet”.

Export Wireless Network Profile

Terminal window
netsh wlan export profile name="YourNetwork" key=clear

Exports the wireless network profile named “YourNetwork” with the password visible in clear text.

Set DNS Server

Terminal window
netsh interface ipv4 set dns "Local Area Connection" static 8.8.8.8

Configures the DNS server address for the network adapter named “Local Area Connection”.

Configure Firewall Rules

Terminal window
netsh advfirewall firewall add rule name="Block Website" dir=out action=block remoteip=www.example.com

Adds a new outbound firewall rule to block outgoing connections to a specific website.

NETSH FAQ:

How do I use netsh in Windows?

To use the netsh command in Windows, execute the following command:

Terminal window
netsh --option <value>

How can I list all available netsh contexts?

To list all available netsh contexts, use the following command:

Terminal window
netsh ?

How do I show all settings in a specific netsh context?

To display all settings in a specific netsh context, use the following command:

Terminal window
netsh advfirewall show currentprofile

How can I reset the TCP/IP stack using netsh?

To reset the TCP/IP stack using netsh, run the following command:

Terminal window
netsh int ip reset

How do I configure a static IP address using netsh?

To configure a static IP address using netsh, use the following command as an example:

Terminal window
netsh interface ipv4 set address "Local Area Connection" static 192.168.1.100 255.255.255.0 192.168.1.1

How can I export netsh configurations to a file?

To export netsh configurations to a file, execute the following command:

Terminal window
netsh dump > netsh-config.txt

Applications of the NETSH Command

  • Configure network interfaces
  • Manage Windows Firewall
  • Diagnose network issues
  • Configure, monitor, and troubleshoot network settings
  • Configure DHCP settings
  • Manage routing tables
  • Monitor network statistics
  • Configure and manage wireless networks