netsh, short for Network Shell, is a command-line scripting utility built into Windows that displays and modifies the network configuration of a local or remote computer. It organizes its functions into nested contexts such as interface, wlan, advfirewall, winhttp and trace, each provided by a helper library, and it can run single commands, an interactive session or a complete configuration script.
In Windows networking, netsh has been a core administration tool since Windows 2000. Many of its tasks now have PowerShell equivalents, yet netsh remains the quickest way to perform resets, export wireless profiles, configure system proxies and capture network traces on any supported Windows edition.
How netsh contexts and helpers are structured
netsh works as a shell with a command hierarchy. Each top-level context is implemented by a helper DLL registered with netsh, and contexts can contain subcontexts; for example, netsh interface ipv4 sits under the interface context. Typing a context name in interactive mode moves into it, and ? lists the available commands at that level.
The following table summarizes the contexts that administrators use most often on current Windows versions.
| Context | Purpose | Example command |
|---|---|---|
| interface ipv4 / ipv6 | Addresses, routes, DNS servers, MTU | netsh interface ipv4 show config |
| wlan | Wireless profiles, drivers, hosted settings | netsh wlan show profiles |
| advfirewall | Windows Defender Firewall profiles and rules | netsh advfirewall show allprofiles |
| winhttp | System-wide proxy for services | netsh winhttp show proxy |
| winsock | Winsock catalog and layered providers | netsh winsock reset |
| trace | Packet capture and diagnostic tracing | netsh trace start capture=yes |
| http | HTTP.sys URL reservations and certificates | netsh http show urlacl |
Commands that only read state run in a standard prompt, but anything that changes configuration requires an elevated session. Without elevation, netsh usually reports that the requested operation requires elevation and makes no change.
Modes of operation and scripting
netsh can be used in three modes, which makes it suitable both for quick troubleshooting and for repeatable configuration. The table below compares them.
| Mode | How it is invoked | Typical use |
|---|---|---|
| Single command | Full path typed on one line | Quick checks and batch files |
| Interactive shell | netsh followed by context navigation | Exploring options on a live system |
| Script file | netsh -f file.txt or exec inside the shell | Applying a saved configuration |
The dump command writes the current configuration of a context as a script, which can be stored and replayed on another machine. The -r option targets a remote computer, although it depends on the Remote Registry service and is often blocked in hardened environments, where PowerShell remoting or WinRM is preferred.
Common administrative tasks with netsh
Most everyday use of netsh falls into a small set of repairs and configuration changes. Reset commands are the best known, because support teams use them to repair corrupted network stacks after malware removal, VPN client uninstallation or failed driver updates.
netsh winsock resetrestores the Winsock catalog to its default state and removes faulty layered service providers; a restart is required.netsh int ip resetrewrites TCP/IP registry settings to their defaults, which also clears manual addressing.netsh wlan export profilesaves wireless profiles as XML files for migration or deployment.netsh winhttp import proxy source=iecopies the user proxy to the system WinHTTP proxy used by services such as Windows Update.netsh interface portproxy add v4tov4creates a TCP port forwarding rule, often used with virtual machines and WSL.
The trace context deserves special mention: netsh trace start capture=yes records packets and provider events into an ETL file without installing any capture driver. The file can be analyzed in Microsoft diagnostic tools or converted to the pcapng format for Wireshark.
netsh compared with PowerShell networking cmdlets
Microsoft has stated that netsh functionality may be removed in future versions and recommends PowerShell modules such as NetTCPIP, NetAdapter and NetSecurity for new automation. In practice, the two tools coexist, and each has clear strengths.
| Task | netsh | PowerShell alternative |
|---|---|---|
| Set a static IP address | interface ipv4 set address | New-NetIPAddress |
| Create a firewall rule | advfirewall firewall add rule | New-NetFirewallRule |
| Export wireless profiles | Native and simple | No built-in cmdlet |
| Reset Winsock | Native and simple | No built-in cmdlet |
| Bulk changes across servers | Limited remote support | Object pipeline and remoting |
PowerShell returns structured objects that are easier to filter and validate, while netsh returns text that scripts must parse. The older netsh firewall context is already deprecated in favor of advfirewall, and some legacy contexts no longer exist in current releases.
Limitations, risks and common mistakes
netsh acts immediately and has no undo function, so a mistyped command can disconnect a remote session or silently weaken a firewall. Experienced administrators export the relevant context with dump or advfirewall export before making changes.
| Mistake | Consequence | Prevention |
|---|---|---|
| Changing the address of the remote session adapter | Lost connection to the server | Use console access or a scheduled rollback |
| Running resets as a first step | Manual settings and VPN adapters lost | Diagnose with show commands first |
Revealing Wi-Fi keys with key=clear | Password exposed on screen or in logs | Restrict to authorized support staff |
| Adding broad allow rules | Unintended exposure of services | Scope rules by profile, port and address |
Output formats can also vary between Windows versions and display languages, so scripts that parse netsh text output are fragile. For long-lived automation, PowerShell or configuration management tools are the more robust choice.
Stripped to the essentials
netsh is a text-based control panel for networking in Windows. Instead of clicking through settings windows, a technician types short commands to see or change how the computer connects to networks.
It is especially handy for repairs. When internet access breaks in a strange way, a single netsh command can put the network settings back to factory defaults. It can also save Wi-Fi details, set proxy servers and record network traffic for analysis. Because it changes things instantly, it should be used with care and the right permissions.
Where it is applied
A help desk technician at a regional accounting firm receives a ticket from an employee whose laptop shows a Wi-Fi connection but cannot open any website after a third-party VPN client was removed. Other devices on the same network work normally.
In an elevated prompt, the technician first runs netsh winhttp show proxy and netsh interface ipv4 show config to rule out a stray proxy or a wrong DNS server. Both look correct, so the suspicion turns to a leftover layered service provider. The technician runs netsh winsock reset followed by a restart.
After the reboot, browsing works again. For the record, the technician also starts a short netsh trace capture to confirm normal DNS traffic and attaches it to the ticket. The fix takes about ten minutes without reinstalling network drivers or reimaging the laptop.