---
title: "The Conclusive Netsh : Ultimate Guide"
description: "Take a comprehensive look into Netsh fundamentals and learn in-depth how to utilize this powerful tool via real-world examples!"
canonical: "https://adamtheautomator.com/netsh/"
---

# The Conclusive Netsh : Ultimate Guide

> Take a comprehensive look into Netsh fundamentals and learn in-depth how to utilize this powerful tool via real-world examples!

Source: https://adamtheautomator.com/netsh/

---

ATA Learning

Tap to hide

[

ATA Learning

](/)

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Search for:  

*   [](https://twitter.com/adbertram)
*   [](https://github.com/Adam-the-Automator)
*   [](https://www.linkedin.com/company/adam-the-automator-llc)
*   [](/feed/)

![The Conclusive Netsh : Ultimate Guide](https://adamtheautomator.com/wp-content/uploads/2022/05/The-Conclusive-Netsh-Ultimate-Guide.jpg)

# The Conclusive Netsh : Ultimate Guide

[![](https://secure.gravatar.com/avatar/2beb65fca997135120ed98dc6a2e57dcdf1a7d7d2f5ff687b5d91dc7ccd7a6b5?s=192&d=mm&r=g)Sagar](https://adamtheautomator.com/author/shanky-mendiratta/)19 May 202215 min. read

Categories: [IT Ops](/category/it-ops/)

Tags:[Command Line](/tag/command-line/)

Table of Contents

*   [Prerequisites](#prerequisites)
*   [What is Network Shell (Netsh)?](#what-is-network-shell-netsh)
*   [Running Netsh Commands](#running-netsh-commands)
*   [Using Netsh Utility Commands](#using-netsh-utility-commands)
*   [Fetching and Executing Netsh Utility Commands from a Text File](#fetching-and-executing-netsh-utility-commands-from-a-text-file)
*   [Executing Netsh Commands Under a User Account](#executing-netsh-commands-under-a-user-account)
*   [Listing Available Network Interfaces](#listing-available-network-interfaces)
*   [Gathering Information on Network Interfaces](#gathering-information-on-network-interfaces)
*   [Setting a Static IPv4 Address and DNS Server](#setting-a-static-ipv4-address-and-dns-server)
*   [Managing Wired Network Interfaces](#managing-wired-network-interfaces)
*   [Managing the Windows Firewall](#managing-the-windows-firewall)
*   [Capturing Network Traces](#capturing-network-traces)
*   [Diagnosing the Windows Firewall and IPsec Events](#diagnosing-the-windows-firewall-and-ipsec-events)
*   [Validating Incoming and Outgoing Traffic](#validating-incoming-and-outgoing-traffic)
*   [Working with Alias and Unalias Using Netsh Command](#working-with-alias-and-unalias-using-netsh-command)
*   [Reserving a Uniform Resource Locator (URL)](#reserving-a-uniform-resource-locator-url)
*   [Managing Netsh Configuration and Query Commands](#managing-netsh-configuration-and-query-commands)
*   [Managing HTTP System Settings](#managing-http-system-settings)
*   [Automating Netsh Commands Execution with Batch Scripts](#automating-netsh-commands-execution-with-batch-scripts)
*   [Conclusion](#conclusion)

Have you ever run into an issue on a Windows machine with network connectivity? Maybe it was some rogue software installer making unknown changes to registry keys, or perhaps you suspect a virus is installed and need to track down its activity. Luckily [Network Shell (netsh)](https://docs.microsoft.com/en-us/windows-server/networking/technologies/netsh/netsh) utility is just around to help.

Netsh is a command-line utility that allows you to configure and display the status of various network configurations of Windows machines or servers. And in this tutorial, you’ll learn just about every command-line feature Netsh provides.

Ready? Read on and keep your network connectivity at its peak!

## Prerequisites

This tutorial comprises hands-on demonstrations. But so long as you have a Windows PC or server, you’re good to go – This tutorial uses Windows 2019 Datacenter Edition, but Netsh works in all modern Windows editions.

## What is Network Shell (Netsh)?

Before you dive into executing your first `netsh` command, kick-off this tutorial by getting a high-level overview of Netsh. So, what is Netsh anyway?

You might have worked with dozens of networking command-line tools such as ping, tracert, telnet, etc., but they are bound for a specific purpose.

With the Netsh command-line utility, you can configure and work with various network components. These network components are not limited to network interfaces, Windows firewalls, server roles, etc., on computers running Windows Server.

## Running Netsh Commands

You now have a basic idea of Netsh and its usefulness for monitoring and configuring your network. But how do you actually execute `netsh` commands?

You can execute `netsh` commands on command-line consoles like PowerShell or the command prompt on a Windows machine. But as the command prompt’s successor, this tutorial demonstrates running the `netsh` commands on PowerShell.

1\. Log in to your [Windows Server using your RDP client](https://www.snel.com/support/learn-how-to-connect-to-your-server-via-rdp-on-windows-10/). Windows has a default RDP client installed.

Related:[The Top Free Remote Desktop Connection Managers for Windows](https://adamtheautomator.com/remote-desktop-connection-manager/)

2\. After you log in, open [PowerShell as administrator](https://adamtheautomator.com/powershell-run-as-administrator/), and run the `netsh` command below to access the **netsh** command-line session.

```powershell
netsh
```

![Accessing netsh Command-line Session](https://adamtheautomator.com/wp-content/uploads/2022/05/image-298.png)

Accessing netsh Command-line Session

3\. In the **netsh** prompt, run the `help` command to see all commands you can use inside your netsh command-line session. `help`

```bash
help
```

Pick one command you’d like to run, but this tutorial uses the `interface` command.

![Help](https://adamtheautomator.com/wp-content/uploads/2022/05/image-299.png)

Help

4\. Lastly, run the `interface` command below to `show` all available network interfaces. `interface show interface`

```bash
interface show interface
```

![Showing All Available Network Interfaces](https://adamtheautomator.com/wp-content/uploads/2022/05/image-300.png)

Showing All Available Network Interfaces

## Using Netsh Utility Commands

You now have access to the **netsh** prompt, and you’re almost ready to manage your network connectivity. But before you dive deeper into Netsh, you’ll be running basic Netsh utility commands to familiarize yourself with how Netsh works.

There are two ways you can run Nesh utility commands as follows:

*   Run the `netsh` command alone to access the **netsh** prompt, then run the Netsh utility command.

```yaml
netsh
help
```

*   Running the `netsh` command followed by the Netsh utility command.

```yaml
netsh help
```

Like the `help` command you learned in step three of the “Running Netsh Commands” section, run some other Netsh utility commands below that Netsh offers:

*   `/?` – Similar to `help` but commonly used for most of the commands you can use within Netsh utility.

![Displaying all the display all the commands and context using netsh /?](https://adamtheautomator.com/wp-content/uploads/2022/05/image-301.png)

Displaying all the display all the commands and context using netsh /?

*   `show` – This command displays the commands available with each context.

![Showing Available Commands in a Context](https://adamtheautomator.com/wp-content/uploads/2022/05/image-302.png)

Showing Available Commands in a Context

`popd` allows you to restore a context from a first-in-last-out (FILO) stack, while `pushd` pushes the current context on a stack.

Both commands don’t have outputs, but you can append the `help` command to see how these commands function, as shown below.

```powershell
popd help
pushd help
```

![Popping and Pushing Stack](https://adamtheautomator.com/wp-content/uploads/2022/05/image-303.png)

Popping and Pushing Stack

*   The `commit` command commits changes made to the running configuration while in offline mode. In contrast, the `abort` command discards changes made in the running configuration while in offline mode.

These commands don’t have output, but appending the `help` command lets you view the command’s usage.

```powershell
commit help
abort help
```

![Committing and Aborting Changes to the Running Configuration](https://adamtheautomator.com/wp-content/uploads/2022/05/image-304.png)

Committing and Aborting Changes to the Running Configuration

*   `quit` and `bye` – Lets you exit out of Netsh utility.

![Quitting the Netsh Utility (quit)](https://adamtheautomator.com/wp-content/uploads/2022/05/quit.png)

Quitting the Netsh Utility (quit)

![Quitting the Netsh Utility (bye)](https://adamtheautomator.com/wp-content/uploads/2022/05/bye.png)

Quitting the Netsh Utility (bye)

## Fetching and Executing Netsh Utility Commands from a Text File

Like every other command, the `netsh` command allows you to declare parameters while executing tasks for simplicity and flexibility.

When working with Windows network configurations, you’ll find yourself dealing with Netsh. And using parameters in your `netsh` commands comes in handy. One good example is calling upon commands from a dedicated source, like a text file.

Create a file named _myfile.txt_ on your desktop and add the `help` command in the file.

Now, run the `netsh` command below with the `-a` flag to specify the file’s path containing the `netsh` command.

```powershell
netsh -a C:\Users\Administrator\Desktop\myfile.txt
```

Below, you can see the `netsh` command called and executed the `help` command from the _myfile.txt_ file.

> _If you wish to run the command on a remote windows machine, consider using the `-r` flag, as shown below. But make sure the [Remote Registry service runs](https://helpcenter.netwrix.com/bundle/Auditor_10.0/page/Content/Configure_IT_Infrastructure/File_Servers/Windows_Shares/WSh_Remote_Registry.htm) on the remote computer. netsh -r shanky_

![Fetching a Netsh Command from a Text File](https://adamtheautomator.com/wp-content/uploads/2022/05/image-305.png)

Fetching a Netsh Command from a Text File

## Executing Netsh Commands Under a User Account

If you like to keep track of changes you make to your network configuration, run Netsh commands under a user account. How? By using the `-u` parameter followed by the account’s username.

Run the following `netsh` command to list available network interfaces under a user account (`-u`) named `shanky`.

> _To specify the user’s password, append the `-p` parameter followed by the password._

```powershell
netsh -u shanky -p hellopass interface show interface
```

![Running netsh Commands Under a Different User Account](https://adamtheautomator.com/wp-content/uploads/2022/05/image-306.png)

Running `netsh` Commands Under a Different User Account

> _If you need to run the `netsh` command under a user account from a specific domain, consider using the `DomainName\\username` parameter._

## Listing Available Network Interfaces

A network interface connects your computer and a private or public network. And knowing which interface your machine uses and the network configurations to troubleshoot is crucial.

This information helps resolve issues or provide your network configurations to third-party vendors for support.

1\. Execute the `netsh interface` command below to `show` all available interfaces currently present on your machine.

```bash
Running netsh Commands Under a Different User Account
```

As you can see below, only one interface (**Ethernet**) takes care of all the network flow (in/out) from your machine.

![Listing All Network Interfaces](https://adamtheautomator.com/wp-content/uploads/2022/05/image-307.png)

Listing All Network Interfaces

2\. Now, click the start menu, type **ncpa.cpl**, as shown below, and press Enter to open the Network Connections window (step three).

![Opening Network Connections](https://adamtheautomator.com/wp-content/uploads/2022/05/image-308.png)

Opening Network Connections

3\. Finally, verify if the `netsh` command returned the correct details of interfaces. Below, you can see the name of the active interface is **Ethernet**.

![Verifying Network Interfaces](https://adamtheautomator.com/wp-content/uploads/2022/05/image-309.png)

Verifying Network Interfaces

## Gathering Information on Network Interfaces

What other good things come with listing available network interfaces on your system? Dig deeper to get comprehensive information from your network interfaces. Why? In a large organization, other departments require those details if they need to host applications on your network.

Run the following command that works the same as listing (`show`) each network `interface` available. But this time, you’ll get more details about each network interface configuration (`config`), such as **DHCP** status, **IP address**, etc.

Related:[How to Manage Microsoft DHCP Server \[In Depth Tutorial\]](https://adamtheautomator.com/dhcp-scope/)

```powershell
netsh interface ipv4 show config
```

![Checking Information on Available Network Interfaces](https://adamtheautomator.com/wp-content/uploads/2022/05/image-310.png)

Checking Information on Available Network Interfaces

> _The **Loopback Pseudo-Interface** is used mainly for troubleshooting purposes and allows you to connect to servers running on the local machine for testing. But note that the loopback interface does not represent any actual hardware._

## Setting a Static IPv4 Address and DNS Server

From the detailed listing of available interfaces, one of the most important concepts is the IP address of the Windows machine. The IP address for the Ethernet network interface is Dynamic. As a result, the IP address is allocated by itself from the pool of available IP addresses of the subnet.

Related:[How to Use PowerShell to Get an IP Address](https://adamtheautomator.com/powershell-get-ip-address/)

But at times, you need to have a static IP address allocated to your machine, such as to test applications where a reboot of the machine is required. So change the dynamic IP address settings to manual type where IPs remain persistent.

1\. Open the **Network Connections** window to see available network interfaces.

2\. Next, right-click on the Ethernet interface and select properties, opening Ethernet’s **Properties** window.

![Ethernet Properties](https://adamtheautomator.com/wp-content/uploads/2022/05/image-311.png)

Ethernet Properties

3\. Select **Internet Protocol Version 4 (TCP/IPv4)**, as shown below, and click on **Properties** to open the IPV4’s properties window.

![Checking the IPv4 Properties ](https://adamtheautomator.com/wp-content/uploads/2022/05/image-312.png)

Checking the IPv4 Properties

As you can see below, the IP settings are set to obtain an IP address automatically.

Click on **Cancel** to close the **Properties** window, and you’ll manually change the IP address in the following step.

![Viewing IPv4 Address Settings](https://adamtheautomator.com/wp-content/uploads/2022/05/image-313.png)

Viewing IPv4 Address Settings

4\. Now, run the below `netsh interface` command to manually set the following IP address settings:

*   IP Address – `10.0.0.100`
*   Subnet mask – `255.255.0.0`
*   Default [gateway](https://www.cisco.com/c/en/us/products/routers/what-is-a-network-gateway.html) – `10.0.0.1`

```powershell
netsh interface ip set address "Ethernet" static 10.0.0.100 255.255.0.0 10.0.0.1 
```

> _To change the IPv6 address of the Ethernet interface, you will need to use `netsh int ipv6 set to address 7 2001::2`_

> _To roll back to using a dynamic IP address, run the following command: `netsh interface ip set address "Ethernet" dhcp`_

5\. Run the following command to define a DNS server. Doing so allows your Windows machine to communicate to other networks.

```powershell
netsh interface ip set address "Ethernet" static 10.0.0.100 255.255.0.0 10.0.0.1 
```

> _To disable the Ethernet interface on your Windows system, consider running the following command: `netsh interface set interface name="Ethernet" admin=disabled`_

6\. Lastly, as shown below, open the IPv4 settings again as you did in steps two to three to verify the interface’s IP address settings changed.

![Verifying IPv4 Address and DNS Settings](https://adamtheautomator.com/wp-content/uploads/2022/05/image-314.png)

Verifying IPv4 Address and DNS Settings

## Managing **Wired Network Interfaces**

You previously managed the Ethernet network interface, but there could be multiple interfaces, such as wireless, wired, and Bluetooth-based network interfaces. What if you need information only for wired network interfaces as they are most important?

Consider using Netsh commands for wired LAN that provide methods to configure connectivity and security settings. The Netsh `lan` commands configure the local computer or multiple computers using a logon script.

Run the `netsh lan` command below to list all the wired network interfaces available on your Windows machine.

```powershell
netsh lan show interfaces
```

![Listing All Wired Network Interfaces](https://adamtheautomator.com/wp-content/uploads/2022/05/image-315.png)

Listing All Wired Network Interfaces

Now, run the below command if you need to display the list of wired profiles configured on the computer.

> _If the interface parameter is defined, only the profile contents for the specified interface are displayed. Otherwise, all profiles will be displayed with their name and description._

```powershell
netsh lan show profiles interface ="Ethernet"
```

![Displaying the List of Wired Profiles](https://adamtheautomator.com/wp-content/uploads/2022/05/image-316.png)

Displaying the List of Wired Profiles

## Managing the Windows Firewall

Securing your network is a top priority achievable by managing your Windows firewall. How? By adding firewall rules with the Netsh `advfirewall` command. The `advfirewall` command allows you to control and manage your Windows firewall.

> _The `advfirewall` context works mainly on three profile settings; domain, private and public_

Run the below command to enable (`action=allow`) the ping protocol (`icmpv4`) from your Windows firewall by setting a rule named `ALL ICMP V4`.

```bash
netsh advfirewall firewall add rule name="All ICMP V4" dir=in action=allow protocol=icmpv4
```

![Adding Firewall Rule to Allow Ping Protocol](https://adamtheautomator.com/wp-content/uploads/2022/05/image-317.png)

Adding Firewall Rule to Allow Ping Protocol

Now, run the below command to `add` a rule named `Open Port 80` on your machine.

You can choose any port that you’d like to open. But this command opens port 80, allowing traffic to flow in and out.

```bash
netsh advfirewall firewall add rule name= "Open Port 80" dir=in action=allow protocol=TCP localport=80
```

![Opening Ports by Adding Firewall Rule](https://adamtheautomator.com/wp-content/uploads/2022/05/image-318.png)

Opening Ports by Adding Firewall Rule

> _The `advfirewall` context provides the same functionality that the `netsh firewall` context gives. But the `netsh firewall` context might be deprecated in the future._

## Capturing Network Traces

Trace is another crucial context to troubleshoot and collect event information regarding network connections. You can use the `trace` context to collect event information using Event Tracing for Windows (ETW) to log network events.

But first, you’ll have to identify scenarios you can trace your network connections.

> _You can use Netsh to collect a packet capture without installing third-party tools like [Wireshark](https://www.wireshark.org/)._

Related:[How to Use Netsh Trace and PowerShell for Packet Capturing](https://adamtheautomator.com/netsh-trace/)

Run the command below to help you find available scenarios where tracing your network connections would work based on the issue you’re dealing with in your network.

```bash
netsh trace show scenarios
```

As you can see below, multiple scenarios are available to work with `trace`.

![Checking Scenarios Available in Netsh Trace Context](https://adamtheautomator.com/wp-content/uploads/2022/05/image-319.png)

Checking Scenarios Available in Netsh Trace Context

Now, execute the below `netsh trace start` command to capture (`capture=yes`) all network details to a specified [ETL file](https://www.techwalla.com/articles/how-to-read-an-etl-file) (`tracefile`) called `ata_trace.etl`. The `persistent` parameter permanently stores the file in the specified location when the value is true (`yes`).

```bash
netsh trace start capture=yes tracefile=c:\ata_trace.etl persistent=yes maxsize=4096
```

> _If you wish to stop the traces from getting captured, run the below command instead: `netsh trace stop`_

![Fetching the Traces of the Network to Store in a File](https://adamtheautomator.com/wp-content/uploads/2022/05/image-320.png)

Fetching the Traces of the Network to Store in a File

As you can see below, the file (**ata\_trace**) has been created and stored in the **C:\\** drive.

![Viewing the Trace Log File](https://adamtheautomator.com/wp-content/uploads/2022/05/image-321.png)

Viewing the Trace Log File

## Diagnosing the Windows Firewall and IPsec Events

Nowadays, monitoring alerts is crucial for any organization running applications or microservices[.](http://services.To) Perhaps you’ve decided to spin up some new Windows machine or Virtual host and check filtered data about the connectivity and firewall settings. If so, consider using the [Windows Filtering Platform (WFP)](https://docs.microsoft.com/en-us/windows/win32/fwp/windows-filtering-platform-start-page).

The Netsh commands for the WFP allow you to conduct checks and filtration on the firewall for systems that support Windows firewall and [IPsec](https://en.wikipedia.org/wiki/IPsec).

Run the following command to save the current operational state of the WFP and IPsec to an XML file (_wfpstate.xml_) on the working directory by default.

```powershell
netsh wfp show state
```

With a copy of the state file (_wfpstate.xml_), you can further examine the WFP and IPsec state to find the root cause of a problem.

![Saving Windows Firewall and IPsec Events State File](https://adamtheautomator.com/wp-content/uploads/2022/05/image-322.png)

Saving Windows Firewall and IPsec Events State File

Perhaps you like to save the XML file to another location. If so, append the `file` flag and specify a save location, as shown below. Replace `location` with the actual save location and `statefile.xml` with your preferred file name.

```powershell
netsh wfp show state file="location\statefile.xml"
```

![Saving Windows Firewall and IPsec Events State File on Specified Location](https://adamtheautomator.com/wp-content/uploads/2022/05/image-323.png)

Saving Windows Firewall and IPsec Events State File on Specified Location

Now, run the below command to save a list of network traffic events (`netevents`) to a file called _netevents.xml_ in the working directory by default.

> _Like with the wfpstate.xml file, you can also specify a save location and file name for the network traffic events XML file (netevents.xml)._

```bash
netsh wfp show netevents
```

![Saving List of Network Traffic Events](https://adamtheautomator.com/wp-content/uploads/2022/05/image-324.png)

Saving List of Network Traffic Events

If you need to diagnose a specific protocol only, use the `protocol` parameter below.

The below command saves a list of network traffic events only for the TCP/IP protocol in XML format, where `6` is TCP/IP’s [protocol number](https://en.wikipedia.org/wiki/List_of_IP_protocol_numbers).

```powershell
netsh wfp show netevents protocol=6
```

![Saving a list of Network Events for a Specific Protocol](https://adamtheautomator.com/wp-content/uploads/2022/05/image-325.png)

Saving a list of Network Events for a Specific Protocol

## Validating Incoming and Outgoing Traffic

If you’re working with many applications where traffic comes in and leaves your network, you need to validate that traffic. How? Winsock is an interface that allows you to handle all the input/output requests for internet applications in a Windows system.

Execute the following `netsh winsock` command to `show` all the stored Windows sockets installed on your machine.

```powershell
netsh winsock show catalog
```

Below, you can see all the Windows sockets entries and details of each one.

![Viewing Windows Sockets Entries](https://adamtheautomator.com/wp-content/uploads/2022/05/image-326.png)

Viewing Windows Sockets Entries

The Winsock catalog tends to contain incorrect entries or becomes corrupt. In that case, run the `netsh` command below to perform a Winsock reset. This command sets the Winsock catalog and associated registry settings to their defaults

Related:[How and Why to Use the Netsh Winsock Reset Command (In 2021)](https://adamtheautomator.com/netsh-winsock-reset/)

```bash
netsh winsock reset
```

![Resetting the Winsock Catalog to Default](https://adamtheautomator.com/wp-content/uploads/2022/05/image-327.png)

Resetting the Winsock Catalog to Default

## Working with Alias and Unalias Using Netsh Command

Alias is an essential concept in networking. An alias instructs the shell to replace one string with another while executing the commands. Similarly, Netsh also uses Alias, a user-defined character string, which Netsh treats as a look-alike to another character string.

The syntaxes to add and delete an alias are below:

```powershell
# Adds an alias
netsh add alias
# Deletes an alias
netsh delete alias
```

### Reserving a Uniform Resource Locator (URL)

Reserving a URL properly in your system is crucial to defining the syntax of a URL endpoint to a web application. A reserved URL is defined for both the Web service and the web portal when configuring the applications on a server.

Three options are used along with the `netsh` command, `add urlacl`, `show urlacl`, and `delete urlacl`.

1\. Run the below command to reserve a URL entry in the system where, `url` specifies the fully qualified URL, and `user` specifies the user or user-group name (`DOMAIN`).

```powershell
netsh http add urlacl url=https://127.0.0.1:80/ user=\Everyone
```

![reserve a URL entry in the system](https://adamtheautomator.com/wp-content/uploads/2022/05/image-328.png)

reserve a URL entry in the system

Next, run the below command to `show` the list of all access control lists for a particular reserve URL (`https://127.0.0.1:80/`)

```powershell
netsh http show urlacl url=https://127.0.0.1:80/
```

![Listing Access Controls](https://adamtheautomator.com/wp-content/uploads/2022/05/image-329.png)

Listing Access Controls

3\. Finally, execute the command below to delete reserved URLs.

```powershell
netsh http delete urlacl url=https://127.0.0.1:80/
```

![Deleting Reserved URLs](https://adamtheautomator.com/wp-content/uploads/2022/05/image-330.png)

Deleting Reserved URLs

### Managing Netsh Configuration and Query Commands

Nowadays, broadband and networking are crucial on laptops, computers, and mobiles. And knowing how to query and configure mobile broadband settings and parameters comes in handy.

But first, you must ensure the [WWAN AutoConfig service](http://batcmd.com/windows/10/services/wwansvc/) is running.

1\. Run the below command to `start` the `wwanSvc` service. `net start wwanSvc`

```powershell
net start wwanSvc
```

![Starting the WWAN AutoConfig Service](https://adamtheautomator.com/wp-content/uploads/2022/05/image-331.png)

Starting the WWAN AutoConfig Service

2\. Next, run the `netsh add` command below to add a network `profile` (`Wi-Fi-Marriott Bonvoy.xml`) in the mobile broadband interface’s profile data store configuration table.

Be sure to change `Wi-Fi-Marriott Bonvoy.xml` with the network profile (XML file) you like to add.

> _To check all the Mobile Broadband interfaces, run the below command. `netsh mbn show interface`_

```powershell
netsh wlan add profile filename="c:\New folder\Wi-Fi-Marriott Bonvoy.xml"
```

![Adding a New WLAN Profile in the System](https://adamtheautomator.com/wp-content/uploads/2022/05/image-332.png)

Adding a New WLAN Profile in the System

> _Perhaps you like to export a network profile. If so, run the following command, where `SSID` is the network interface, and `destination` is the network profile’s save path: `netsh wlan export profile "SSID" key=clear folder=destination`_

3\. Run the following command to `connect` to a particular mobile broadband network interface (`delhi_Sagar_5GHz)`. Replace `Wi-Fi Network` with your Wi-Fi network name.

```powershell
netsh wlan connect name="Wi-Fi Network"
```

![Connecting to a Wi-Fi Network](https://adamtheautomator.com/wp-content/uploads/2022/05/image-333.png)

Connecting to a Wi-Fi Network

4\. Execute the below command to `delete` a network config profile (`Marriott Bonvoy`).

Deleting a network config profile from the profile data store is similar to running `add` command. The difference is that you’ll replace `add` with the `delete` sub-context in the command.

```powershell
netsh wlan delete profile name="Marriott Bonvoy"
```

![Deleting a WLAN profile in the system](https://adamtheautomator.com/wp-content/uploads/2022/05/image-334.png)

Deleting a WLAN profile in the system

5\. Now, run the following `netsh dump` command to capture and display interface configuration scripts.

```powershell
netsh dump
```

![Capturing Interface Configurations Details ](https://adamtheautomator.com/wp-content/uploads/2022/05/image-335.png)

Capturing Interface Configurations Details

If you wish to have a copy of the configuration details you can later review, run the following command. This command doesn’t print anything on the console but instead saves the output to a text file (`netconfig.txt`).

```powershell
netsh dump > netconfig.txt
```

6\. Execute the `netsh set` command below to set the configuration of specified interfaces, such as the following:

*   Setting the mobile broadband data auto-connect state for the given interface.
*   Turning the mobile broadband data on or off for the specified profile set or interface.
*   Setting the mobile broadband data highest connection category for the given interface.

```bash
netsh set
```

![Configuring Specified Interfaces](https://adamtheautomator.com/wp-content/uploads/2022/05/image-336.png)

Configuring Specified Interfaces

## Managing HTTP System Settings

Another important `netsh` command to look at is `netsh http`, which allows you to query and configure [HTTP.sys settings](https://docs.microsoft.com/en-us/troubleshoot/developer/webapps/iis/iisadmin-service-inetinfo/httpsys-registry-windows) and parameters.

These HTTP.sys settings can be, but are not limited to the following:

*   The cache of the HTTP service.
*   All the cached URL resources of the HTTP service.
*   All certificate bindings.
*   A snapshot of all the HTTP services.

Windows HTTP Services provides developers with an HTTP client API to send requests through the HTTP protocol to other HTTP servers.

Execute the below `netsh` command to `show` you a list of all the commands you can run to view the `http` service-related settings and configurations.

```powershell
netsh http show
```

Below, you’ll see various options you can use with the `netsh http` command.

![Viewing Available Commands for netsh http Command](https://adamtheautomator.com/wp-content/uploads/2022/05/image-337.png)

Viewing Available Commands for `netsh http` Command

Now, run the below command to verify the HTTP settings and configuration, cacheparam perhaps.

```powershell
netsh http show cacheparam
```

![Viewing HTTP Cache Parameters](https://adamtheautomator.com/wp-content/uploads/2022/05/image-338.png)

Viewing HTTP Cache Parameters

## Automating Netsh Commands Execution with Batch Scripts

So far, you learned everything you need to know about Netsh utility, so consider yourself a pro. But at times, you need to run dozens of commands in one go and store the results. So why not automate executing Netsh commands with Batch scripts?

Create a file named _myfile.bat_ on your desktop and copy/paste the code below to the _myfile.bat_ file. The code below shows all network interfaces and configurations of all network interfaces.

```powershell
# Show all the interfaces of the Windows System
interface show interface
# Show the configurations of all the interfaces 
interface ipv4 show config
# Show all the Wired lan network interfaces
lan show interfaces
# Updating the firewall rule to add ping protocol
advfirewall firewall add rule name="All ICMP V4" dir=in action=allow protocol=icmpv4
# Show all the events in the network
wfp show events
# Show all the network events
wfp show netevents
```

Next, run the below `netsh` command to execute the `myfile.bat` script from the specified folder path (`-f C:\Users\Administrator\Desktop\`).

```powershell
netsh -f C:\Users\Administrator\Desktop\myfile.bat
```

As you can see below, the `netsh` commands inside the batch file (_myfile.bat_) were executed successfully.

![Executing Netsh Commands with a Batch Script](https://adamtheautomator.com/wp-content/uploads/2022/05/image-339.png)

Executing Netsh Commands with a Batch Script

## Conclusion

Throughout this tutorial, you’ve learned different `netsh` commands to control your network configuration and diagnose potential issues. Netsh utility is a free tool with many features you can use whether you’re just checking out your network configuration or monitoring your network closely.

With this newfound knowledge, you can now monitor interfaces, run trace commands and scripts, and even convert all IP address settings.

Now that you’re a Netsh guru, how do you plan to use it? Why not automate command executions by compiling commands into a PowerShell script you can run at will?

Related:[How to Run a PowerShell Script From the Command Line and More](https://adamtheautomator.com/run-powershell-script/)

Share this article

[Share on X](https://twitter.com/intent/tweet?url=https%3A%2F%2Fadamtheautomator.com%2Fnetsh%2F&text=The%20Conclusive%20Netsh%20%3A%20Ultimate%20Guide)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fadamtheautomator.com%2Fnetsh%2F)[Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fadamtheautomator.com%2Fnetsh%2F)

## Related Posts

![](https://adamtheautomator.com/wp-content/uploads/2026/06/26989-monitor-windows-servers-prometheus-grafana-codex.webp)

### [How to Monitor Windows Servers with Prometheus and Grafana](/monitor-windows-servers-prometheus-grafana/)

Set up Windows Server monitoring with windows\_exporter, Prometheus, Grafana, and Alertmanager. Learn how to secure port 9182, scrape targets, and validate alerts.

![](https://adamtheautomator.com/wp-content/uploads/2026/05/featured_image-11.webp)

### [How to Troubleshoot Active Directory Replication Errors](/troubleshoot-active-directory-replication-errors/)

Troubleshoot Active Directory replication errors by isolating 1311, 1722, 2087, and USN rollback issues with repadmin, dcdiag, DNS, RPC, and KCC checks.

![](https://adamtheautomator.com/wp-content/uploads/2026/04/featured_image-6.webp)

### [How to Survive the 2026 Secure Boot Certificate Expiry](/survive-2026-secure-boot-certificate-expiry-3/)

Deploy Windows UEFI CA 2023 before the June 2026 certificate expiry. Inventory devices, update OEM firmware, and trigger enrollment via Intune or PowerShell registry settings.

## Categories

*   [IT Ops](/category/it-ops/)
*   [Cloud](/category/cloud/)
*   [DevOps](/category/devops/)
*   [Home Ops](/category/home-ops/)
*   [Information Security](/category/infosec/)
*   [Software Development](/category/software-development/)

## Site

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Copyright 2026© ATA Learning | [Privacy Policy](/privacy/)
