Computer

WiFi, how to manage the connection from the Windows command line

WiFi, how to manage the connection from the Windows command line

Most users are used to dealing with the WiFi from the area of ​​the traybar of Windows. By clicking on the icon next to the system clock, you get the list of reti wireless available nearby and connect to one of them.

When the connection has already been established, by clicking on the “i” that appears to the right of the name of the network wifiit is possible to know all the details by verifying the use of WiFi 4, WiFi 5, WiFi 6, WiFi 6E, the type of security in use (for example WPA3), the frequency band used, the speed of the connection in Mbps or in Gbps, the IPv4 and IPv6 addresses assigned by the local DHCP server and so on.

WiFi: Windows wireless network settings

The box Automatically connect when you’re in the field causes Windows to establish a connection as soon as your system detects the SSID or theWiFi identifier in the immediate vicinity.

Pressing the key combination Windows+Iby clicking on Network and the Internet in the left column, up WiFi so on Manage known networks, you get the list of wireless networks you have connected to in the past. With one click Cancel storageit’s possible “make you forget” the WiFi al sistema Windows.

Manage WiFi from the command line in Windows

The complete list of WiFi networks set up on the Windows system can also be easily retrieved from the command line of Windows 10 and 11. Although the command that allows you to have the list of wireless networks known to the system does not require administrator rights, we still suggest typing cmd in the Windows search box and then select Run as administrator. This is because some of the commands that we propose further on can only be used with administrator rights.

You access the list of WiFi known to the Windows system in use by typing the following:

netsh wlan show profiles

The command netsh wlan show profile name="nome_rete" allows you to get the details about the WiFi connection profile corresponding to “network_name“. The only information that is not shared unencrypted is the login password to the wireless network. In fact, Windows limits itself to returning the information Security key: present.

Extract the password for connecting to the WiFi network

The only information that is hidden using the command presented above is the security key which allows you to access the WiFi and which is stored in Windows. To still have this data, just run the next command by opening the command prompt with administrator rights (that’s why we previously recommended acquiring them right away):

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

By simply adding key=clearWindows shows the plaintext password next to Key content. We explain it better in the article on how to recover WiFi password in Windows.

Details about the wireless driver used for connections

The command netsh wlan show drivers offers a really interesting insight into the potential of network card. In addition to knowing the name of the driver of the wireless card, which appears in the window Device manager, Network adaptersthe command returns the 802.11 protocol versions, frequency bands (2.4, 5, and 6 GHz), supported authentication and encryption protocols.

WiFi card driver characteristics

In another article we talked about the speeds realistically achievable with the various WiFi standards.

Furthermore, to gather more information on the potential of the WiFi card, the following command can be issued if necessary:

netsh wlan show wirelesscapabilities

Wireless network interfaces and related settings

In Windows, the term “network card” e “network interface” are often used interchangeably. They actually have slightly different meanings.

With expression network card this refers to the physical hardware installed in a computer to allow it to connect to a network. It is a piece of hardware that can be built directly onto the computer motherboard or connected via a USB or PCI port. A network card contains the circuitry and electronic components that allow your device to communicate with other networks and devices through Ethernet network cables or wireless connections.

Network interface, on the other hand, refers to an entity instantiated at the software level which in turn allows you to manage and control the network card and related functions. It allows the operating system to manage the network connectionsassign IP addresses, configure network settings, transmit and receive data through the physical network card.

The network interfaces can be both physical and virtual or “point” to a real network card or created for the management of virtual boards used by virtual machines and in general by virtualization software or by VPN solutions.

Even in newer versions of Windows, to access the full list of interfaces of physical and virtual networkswe usually press the key combination Windows+R then type ncpa.cpl.

The following command gets the i network interface names on your Windows machine:

netsh wlan show interfaces

It is also possible to extrapolate the data of just one of the WiFi connections using the following syntax:

netsh wlan show interface name="nome_interfaccia"

If there is only one wireless interface, the result offered by the two commands will be the same.

Prioritize WiFi connections in Windows

If you are within range of two networks that have different SSIDs but are both known to the operating system, Windows always gives priority to connecting to priority maggiore.

To change the priority of WiFi connections, you can type the following command, taking care to make the appropriate replacements:

netsh wlan set profileorder name="nome_rete" priority=1 interface="nome_interfaccia"

Priority 1, as specified in the example, is the highest of all.

Log in and out manually. Avoid automatic connections to the network

Interesting commands, which can also be used within script developed “ad hoc”, are those that allow you to disconnect the WiFi in use and establish a new connection without acting on the icon in the traybar di Windows:

  • netsh wlan disconnect disconnect the network and drops any wireless connection you may be using.
  • netsh wlan connect name="nome_rete" establishes a connection with the WiFi network of the indicated name.

Using a simple command at the prompt, you can prevent Windows from automatically establishing a connection to your WiFi network. Just type the following to do this:

netsh wlan set profileparameter name="nome_rete" connectionmode=manual

To understand how the WiFi card behaves in Windows, it is possible to request the generation of a report on its operation. The command netsh wlan show wlanreport produces a report in HTML format (can be opened with the default browser) which shows, also in graphic form, the connectivity status, when the connection was established, when the network was disconnected, any errors and much more. In the report you will find details about network interfaces, successful and failed sessions, reasons for disconnections.

L’deleting a connection Finally, WiFi configured in Windows can be requested by issuing the command netsh wlan delete profile name="nome_rete".

Opening image credit: iStock.com/LightFieldStudios

Leave a Reply

Your email address will not be published. Required fields are marked *