Managing wireless networks via the command line is a powerful tool that's often overlooked by casual users who prefer the graphical interface. However, in situations where the Windows graphical shell freezes, drivers aren't working correctly, or remote administration is required, it's precisely this that comes into play. command line becomes a lifesaver. It allows for fine-tuning that's impossible to achieve with standard system tools.
Working with netsh and other utilities gives you complete control over your network adapter. You can not only connect to an access point, but also analyze signal quality, delete old profiles that are interfering with the connection, or even create your own hotspot. This level of control is available to system administrators and advanced enthusiasts.
In this article, we'll cover every step of working with wireless networks via the terminal. We'll cover command syntax, troubleshooting methods, and automation techniques. Even if you've never opened a console before, these step-by-step instructions will help you master this skill.
Launch Command Prompt with Administrator Privileges
Any actions related to changing network settings require elevated privileges. Launching the terminal normally won't allow you to make changes to the adapter configuration or save new network profiles. Therefore, the first and most important step is to run the utility as administrator.
There are several ways to do this. The fastest is to press a key combination. Win + X and select "Windows Terminal (Administrator)" or "Windows PowerShell (Administrator)". In older versions of the system, you can use the search: enter cmd In the search bar, right-click on the result and select the appropriate menu item.
⚠️ Note: If you run the console without administrator rights, the commands will run, but the system will return an "Access Denied" error when attempting to change settings. Make sure the window title says "Administrator."
Once the window opens, you'll see a black or blue background with a blinking cursor. The interface may seem intimidating, but it's extremely effective. All commands are entered from the keyboard and confirmed with the key. EnterTo paste text from the clipboard in a modern terminal, simply right-click or use the keyboard shortcut Ctrl + V.
Analysis of available wireless networks
Before attempting to connect, you need to understand which networks your adapter sees. The standard interface only shows a list of icons, but the console provides much more technical information. To scan the airwaves, use the command netsh wlan show networks.
Running this command will display a list of all detected access points within range. For each network, several critical parameters will be displayed: SSID (network name), security type (e.g., WPA2-Personal), and, most importantly, signal strength. Signal strength is displayed as a percentage, allowing you to select the one with the best coverage.
- 📡 SSID — the name of the wireless network that is displayed in the list of available connections.
- 🔒 Authentication — the type of security protocol used to encrypt data.
- 📶 Signal — percentage signal strength, where 100% means ideal connection quality.
If the list is empty, it may mean the wireless adapter is disabled, the driver is not installed, or the WLAN AutoConfig service is stopped. Normally, you'll see a list sorted by signal strength. Pay attention to the channels if you plan to configure the router to avoid interference with neighboring routers.
Connecting to a known network via console
If you've previously connected to the desired network from this computer, the profile is saved in the system memory. In this case, the connection process is extremely simplified. You don't need to re-enter the password; simply initiate the connection with a command.
Use the construction netsh wlan connect name="Profile_Name"Please note that the profile name must match the one saved in the system. This is often the same as the network name (SSID), but if you renamed the profile manually, use its name. To view a list of saved profiles, enter netsh wlan show profiles.
netsh wlan connect name="Home_WiFi"
After entering the command, the system will attempt to connect. If successful, you'll see the message "Connection request successful." If the profile is corrupted or the router's security settings have changed, the system will report an error. In this case, it's best to delete the old profile and create a new one.
Create a new profile and connect with a password
Things get more interesting when you need to connect to a new network that's not yet known to the system. The graphical interface will prompt you for a password in a pop-up window, but in the console, you need to create an XML configuration file. This may seem complicated, but in reality, the procedure is strictly regulated.
First, you need to generate a profile template. Run the command netsh wlan show profiles name="Network_Name" key=clear — No, it's for viewing. To create a new file, use the export command or create a text file manually. However, there's a faster way without working with files: use the add key command.
But the most reliable method for scripts is to create an XML file. You can create a file wifi.xml in the root of drive C: with the following contents, replacing the data with your own:
<?xml version="1.0"?><WLANProfile xmlns="http://www.microsoft.com/network/WLAN/profile/v1">
<name>MyNetwork</name>
<SSIDConfig>
<SSID>
<name>MyNetwork</name>
</SSID>
</SSIDConfig>
<connectionType>ESS</connectionType>
<connectionMode>manual</connectionMode>
<MSM>
<security>
<authEncryption>
<authentication>WPA2PSK</authentication>
<encryption>AES</encryption>
<useOneX>false</useOneX>
</authEncryption>
<sharedKey>
<keyType>passPhrase</keyType>
<protected>false</protected>
<keyMaterial>Your_Password</keyMaterial>
</sharedKey>
</security>
</MSM>
</WLANProfile>
After creating the file, add the profile to the system using the command netsh wlan add profile filename="C:\wifi.xml"Then connect as described in the previous section. This method is ideal for mass deployment of settings across offices.
⚠️ Attention: In the tag<keyMaterial> The password is stored in cleartext. Anyone with access to this XML file can read your password. Delete the file immediately after use or protect it with access rights.
Diagnosing and managing Wi-Fi profiles
The console not only allows you to connect, but also deeply diagnose problems. If the connection is unstable, the command netsh wlan show interfaces Displays detailed statistics: current transmission speed, radio type (802.11ac/n), channel, and noise level. This information is invaluable for identifying sources of interference.
It is often necessary to delete an old profile that is interfering with the connection or contains an incorrect password. The command netsh wlan delete profile name="Profile_Name" This will completely clear the settings for the specified network. You can then recreate the profile with the correct data.
Network priorities are managed by profile sorting. Windows attempts to connect to networks in descending priority order. You can change the order, although this is rarely necessary in home settings. It's more useful to know how to reset the entire TCP/IP stack and Wi-Fi settings using the command netsh winsock reset And netsh int ip reset, but this already requires a reboot.
Hidden Commands for Experts
The 'netsh wlan report' command generates a detailed HTML report of all wireless events for the last three days. The file is saved in the system folder and helps identify the cause of connection interruptions.
Table of basic Wi-Fi commands
To save you the trouble of memorizing all the syntax, we've prepared a summary table of the most useful commands. Save it or keep it handy when setting up your network. These commands work on all modern versions of Windows, starting with Windows 7 and ending Windows 11.
| Team | Description of action | Necessary rights |
|---|---|---|
netsh wlan show networks |
Scanning for available wireless networks | User |
netsh wlan show profiles |
Displaying a list of saved profiles | User |
netsh wlan connect name="Name" |
Connecting to the specified network | Administrator |
netsh wlan delete profile name="Name" |
Deleting a network profile | Administrator |
netsh wlan show interfaces |
Detailed information about the current connection | User |
Using these commands allows you to automate routine tasks. For example, you can create a BAT file that will disable and re-enable the wireless adapter when launched, which is often faster than waiting in the graphical interface.
☑️ Checklist before entering commands
Troubleshooting common connection errors
Even experienced users encounter errors. One of the most common is "Unable to connect to this network." In the console, this is often due to a security type mismatch. If the router uses WPA3, but the profile is configured for WPA2, the connection will fail. Check the settings using show networks.
Another problem is drivers. If the command netsh wlan show interfaces If you get an error or the adapter isn't showing up, the WLAN AutoConfig service may be disabled. Check its status in services.msc. The following command also helps: netsh int ip reset, which resets the protocol stack.
- 🔄 Resetting the adapter:
netsh interface set interface name="Wi-Fi" admin=disabledthenenabled. - 🗑️ Cleaning profiles: Delete all profiles with the command
netsh wlan delete profile name=* i=Wi-Fi. - 🔑 Security key: Checking the correctness of the entered password in the XML file.
If all else fails, update your wireless adapter drivers from the manufacturer's website. Console commands are ineffective against physical hardware failure or critical driver errors.
Is it possible to connect to a hidden network (SSID Hidden) via console?
Yes, this is possible. When creating an XML profile, you need to add the tag <hidden>true</hidden> in the SSIDConfig section. The network name must also be specified precisely, as automatic detection will not work.
How do I find out the password for an already connected Wi-Fi network?
Use the command netsh wlan show profile name="Network_Name" key=clearIn the "Security Settings" section, there will be a "Key Contents" field where the password is displayed in clear text. Administrator rights are required.
Do these commands work in PowerShell?
Absolutely. PowerShell fully supports utilities. netshYou can combine PowerShell network commands (NetAdapter module) and classic netsh commands for more flexible management.
Why does the command say "Interface not found"?
Most likely, your wireless adapter's name is something other than the default "Wi-Fi" or "Wireless Network." Use the command netsh interface show interfaceto find out the exact name and substitute it into the parameters.