Fast, stateless Network Diagnostics

Learn

Netsh WLAN and Interface Commands: A Practical Reference

netsh (Network Shell) is a command-line utility built into Windows for viewing and changing network configuration — Wi-Fi profiles, adapter settings, IP addresses, and more — without opening a Settings panel. It is unrelated to this site beyond the shared name: NetSH.io runs diagnostics from a browser, while netsh runs locally on the Windows machine it is configuring. The sections below cover the specific tasks it is most commonly used for.

Before Running Any Command

  • Open Command Prompt or PowerShell as Administrator. Read-only commands (most show commands) often work without elevation; any command that changes configuration requires it.
  • netsh accepts abbreviated commands as long as they remain unambiguous — netsh int ip is equivalent to netsh interface ip, and the shorter form is used below.
  • Adapter names must match exactly what Windows calls them — typically "Ethernet" or "Wi-Fi" on a default installation, but renamed on many machines. Confirm the name with netsh interface show interface first if a command below reports that it cannot find the adapter.

How to See Saved Wi-Fi Profiles

Lists every Wi-Fi network this machine has connected to and retained credentials for, not only the network it is currently connected to.

netsh wlan show profiles

How to Get a Saved Wi-Fi Password

Displays a saved profile's full details, including the password in plain text under Key Content. This is the most common reason netsh wlan is used — recovering a Wi-Fi password from a machine that is already connected, without requiring physical access to the router.

netsh wlan show profile name="NetworkName" key=clear

How to See Current Wi-Fi Connection Details

Reports the live connection status for each wireless adapter: SSID, signal quality, radio type, channel, and connection speed.

netsh wlan show interfaces

To check the driver in use and which features it supports (hosted network, WPA3, and so on), use the following command instead — useful when a feature appears to be missing rather than misconfigured:

netsh wlan show drivers

How to See Nearby Wi-Fi Networks

Lists every network currently in range, including the individual access points (BSSIDs) behind networks that share one SSID across multiple APs — useful for identifying a weak or misconfigured AP that a phone or laptop repeatedly roams onto.

netsh wlan show networks mode=bssid

How to Connect to or Disconnect from a Wi-Fi Network

Connects using an already-saved profile. This does not work for a network that has never been connected to before — that network must first be connected through Windows' own Wi-Fi interface at least once so that a profile exists.

netsh wlan connect name="NetworkName"

Disconnects the current wireless connection without disabling the adapter itself:

netsh wlan disconnect

How to Delete a Saved Wi-Fi Profile

Removes a saved profile and its stored password — the command-line equivalent of selecting "Forget" on a network in Windows' Wi-Fi settings.

netsh wlan delete profile name="NetworkName"

How to Export or Import a Wi-Fi Profile

Exports a profile as an XML file, useful for provisioning the same network on another machine without re-entering the password. Add key=clear to include the actual password in the export instead of a placeholder.

netsh wlan export profile name="NetworkName" folder=.

To import that profile on another machine:

netsh wlan add profile filename="NetworkName.xml"

How to List Network Adapters and Their Status

Lists every network interface with its admin state (enabled or disabled) and connect state — the fastest way to confirm that an adapter is enabled before proceeding with further troubleshooting.

netsh interface show interface

How to View an Adapter's IP Configuration

Prints the full IP configuration for every interface: address, subnet, gateway, and DNS servers, along with whether each is set statically or via DHCP — the same information ipconfig /all provides, in a format that is easier to script against.

netsh interface ip show config

How to Set a Static IP Address

Assigns a static IP address, subnet mask, and gateway to the named interface, in that order:

netsh interface ip set address name="Ethernet" static 192.168.1.50 255.255.255.0 192.168.1.1

How to Switch an Adapter Back to DHCP

Reverses a static assignment and resumes requesting an address automatically — the command to run when a previously configured static IP conflicts with another device on the network.

netsh interface ip set address name="Ethernet" dhcp

How to Set DNS Servers Manually

Sets a primary DNS server:

netsh interface ip set dns name="Ethernet" static 1.1.1.1

Adds a secondary DNS server without replacing the first:

netsh interface ip add dns name="Ethernet" 1.0.0.1 index=2

Setting DNS servers statically is independent of whether the address itself is static or assigned via DHCP — an adapter can obtain its IP address from DHCP while still using manually configured DNS servers.

How to Enable or Disable a Network Adapter

Disables an adapter entirely — equivalent to right-clicking it and selecting Disable in the Network Connections panel, but scriptable:

netsh interface set interface "Ethernet" admin=disabled

Re-enable the adapter by substituting admin=enabled for admin=disabled.

How to Reset the DNS Cache

This is not actually a netsh command, despite frequently being grouped with them. The command to flush the DNS resolver cache is:

ipconfig /flushdns

It is worth knowing alongside the commands above because both are used in the same situation — a site resolving to the wrong address, or failing to resolve at all after a DNS change — and are easily confused. netsh does not modify the DNS cache; it modifies which DNS servers are configured, not what is currently cached from them.

How to Reset the Network Stack

Two commands, typically run together, for cases where networking is broken in a way no single setting explains — certain sites fail to load, or a VPN or proxy left the system in an inconsistent state after being uninstalled. The first rebuilds the Winsock catalog (the registry entries that allow applications to communicate with the network stack), resolving the common case of applications losing network access while the adapter still shows as connected:

netsh winsock reset

The second resets TCP/IP itself to its default configuration, separately from Winsock:

netsh int ip reset

Both commands require a restart to take full effect, and neither affects saved Wi-Fi passwords or static IP settings on other adapters.

How to Back Up and Restore Network Configuration

Writes every non-default network setting on the machine to a text file, using the same command syntax used to configure it:

netsh dump > netconfig.txt

Replays that file, reapplying the same configuration — useful before a risky change, or for applying identical settings across multiple machines:

netsh exec netconfig.txt

After changing an adapter's IP, DNS, or Wi-Fi settings with any of the commands above, a ping is the fastest way to confirm that the change took effect and the machine can still reach the network.

Frequently Asked Questions

Why does my netsh command say access is denied?

Any command that changes configuration — setting an IP, resetting the network stack, enabling or disabling an adapter — needs Command Prompt or PowerShell opened as Administrator. Most read-only show commands work without elevation; commands that change something generally don't.

Why does netsh say it can't find my adapter?

The adapter name has to match exactly what Windows calls it — often "Ethernet" or "Wi-Fi" by default, but frequently renamed on real machines. Run netsh interface show interface first to see the exact names Windows is using.

Does netsh flush the DNS cache?

No — that's a common mix-up. netsh changes which DNS servers are configured; it doesn't touch what's currently cached from them. To clear the cache itself, use ipconfig /flushdns instead, which isn't a netsh command at all despite often being grouped with them.

Will netsh winsock reset delete my saved Wi-Fi passwords?

No. netsh winsock reset and netsh int ip reset rebuild the Winsock catalog and reset TCP/IP to defaults, but neither touches saved Wi-Fi profiles or static IP settings on other adapters. Both do require a restart to fully take effect.

Can I set DNS servers without changing whether the IP is static or DHCP?

Yes — the two are independent. An adapter can keep obtaining its IP address automatically via DHCP while still using manually configured DNS servers set through netsh interface ip set dns.