Sometimes the standard Windows operating system graphical interface stops responding, and familiar wireless network connection methods become unavailable. In such situations, command line, which allows you to manage network adapters at a low level, bypassing potential visual shell failures. This isn't just a hacker's trick, but a real system administrator tool that can save the day when a driver freezes or the wireless network service is behaving incorrectly.
Working with CLI (Command Line Interface) gives the user complete control over the scanning and authorization process. You can view hidden networks, forcefully disable an adapter, or save connection profiles for quick deployment to other devices. The netsh wlan commands work directly with Windows system services, allowing you to bypass many interface blockers. Understanding these processes is essential for anyone who wants to gain a deep understanding of how their operating system works.
In this article, we'll detail the steps required to successfully connect to an access point without using a mouse. We'll cover not only basic commands, but also security nuances and troubleshooting steps for common errors. Being comfortable with a text-based interface will open up new possibilities for network diagnostics and management.
Launch Command Prompt with Administrator Privileges
The first and most critical step is to launch the console with elevated privileges. Normal user mode will not allow changes to the network adapter configuration, as this requires access to system files. Without administrator privileges, any attempts to execute commands will be blocked. netsh will end with an access denied error.
There are several ways to open the desired tool. The fastest is to press a key combination. Win + R, enter cmd, and then press Ctrl + Shift + EnterYou can also search for "Command Prompt" in the Start menu, right-click, and select the appropriate option. If you're using PowerShell, the syntax may differ, so it's best to use the classic console.
⚠️ Warning: When running as administrator, the system will prompt you for UAC (User Account Control) confirmation. Make sure you are running the system tool and not a script from an untrusted source.
After a successful launch, the console window will have a title prefixed with "Administrator." This indicates that you have all the necessary rights to manage network interfaces. Now you can proceed to analyzing the available wireless space.
Search and analyze available wireless networks
Before attempting to connect, you need to ensure your Wi-Fi adapter is active and can see nearby access points. To do this, use the scan command, which lists all networks within range of your receiver. This is especially useful if the desired network is hidden or has a weak signal.
Type the following command and press Enter:
netsh wlan show networks
The system will display a list of networks with their SSID (name), security type, and signal strength. Note the network's serial number in the list if you plan to connect to it, although the network name is more commonly used. If the list is empty, check the antenna's physical connection or the status of the drivers.
For more detailed information about a specific network, you can add the network name parameter. This will help you find out the supported frequencies and channels:
netsh wlan show networks name="MyWiFi" mode=bssid
Here MyWiFi — is the name of the network you're looking for. This command will display the MAC addresses of the access points (BSSIDs), which is useful in offices with multiple routers broadcasting the same SSID. Choose the network with the lowest bandwidth usage for the best speed.
Creating and saving an XML connection profile
Windows doesn't allow you to connect to a secure network by simply entering a password on the fly in the command prompt. You must first create an XML profile file containing the security settings and encryption key. This method is more secure because the password isn't saved in the command history.
Create a text file with a name like, wifi-profile.xml in a convenient folder (for example, on your desktop). Open it with Notepad and paste the following structure, replacing the data with your own:
<?xml version="1.0"?><WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1">
<name>MyHomeNetwork</name>
<SSIDConfig>
<SSID>
<name>MyHomeNetwork</name>
</SSID>
</SSIDConfig>
<connectionType>ESS</connectionType>
<connectionMode>auto</connectionMode>
<MSM>
<security>
<authEncryption>
<authentication>WPA2PSK</authentication>
<encryption>AES</encryption>
<useOneX>false</useOneX>
</authEncryption>
<sharedKey>
<keyType>passPhrase</keyType>
<protected>false</protected>
<keyMaterial>MySuperPassword123</keyMaterial>
</sharedKey>
</security>
</MSM>
</WLANProfile>
It is important to correctly specify the authentication type in this file. For home networks, the most commonly used type is WPA2PSK and encryption AESIf you have an older router, you may have to choose WPAPSK or TKIP. Field keyMaterial contains your Wi-Fi password.
Where can I find precise security parameters?
To find out the exact security type of your network, run the command netsh wlan show networks mode=bssid . The Authentication line will indicate the method (e.g., WPA2-Personal), and the Encryption line will indicate the encryption type (AES or TKIP). This information must be accurately copied into the XML file.
After saving the file, proceed to import it. Make sure the file is in an accessible directory and run the add profile command:
netsh wlan add profile filename="C:\Users\Admin\Desktop\wifi-profile.xml"
The system should report the profile was successfully added. The operating system is now aware of this network's existence and has the keys to access it.
The process of connecting to a Wi-Fi network
Once the profile is created and added to the system, you can initiate a connection. This is done with a single short command that accesses the wireless interface. This interface is usually called "Wireless Network" (on Russian-language Windows) or "Wi-Fi."
Use the following syntax to connect:
netsh wlan connect name="MyHomeNetwork" interface="Wi-Fi"
Here name — is the profile name you specified in the XML file (it should match the SSID unless you changed the name tag separately), and interface — the name of your network adapter. If you have multiple adapters (for example, a built-in one and a USB one), specifying the interface is required.
- 📶 Successful connection: You will see the message "Connection complete".
- ⏳ Process: The system may take several seconds to negotiate parameters with the router.
- ❌ Error: If the connection fails, check the password in the XML file and the encryption type.
Sometimes the interface name may differ. To find out the exact name, enter the command netsh wlan show interfacesThe list will show the "Name" of the desired adapter. Copy it exactly, including capitalization and spaces.
☑️ Checklist before connecting
Managing profiles and troubleshooting
Over time, many old profiles can accumulate, interfering with automatic connections or creating conflicts. The command line makes it easy to manage this list: delete unnecessary ones, export important settings, or clear the cache.
To view all saved profiles use:
netsh wlan show profiles
If you need to delete a profile (for example, you changed the router password), use the command:
netsh wlan delete profile name="OldNetworkName"
This action irreversibly deletes the saved password and settings for the specified network. The next time you connect, you'll need to recreate the profile or enter the password through the graphical interface.
⚠️ Caution: Deleting system or corporate network profiles may result in loss of access to internal organization resources. Use caution when clearing the list.
It is also useful to know the command to reset the WLAN settings if the adapter is behaving erratically:
netsh wlan reset
This command resets your wireless network settings to factory defaults, deleting all logs and temporary configurations. You may need to restart your computer after running this command.
Table of basic commands and parameters
For your convenience, below is a summary table of the basic commands you might need when managing Wi-Fi via the console. Save it as a cheat sheet.
| Team | Description of action | Example of use |
|---|---|---|
show interfaces |
Displays the status of all wireless adapters. | netsh wlan show interfaces |
show networks |
Scans the air and displays available networks | netsh wlan show networks |
add profile |
Adds a new profile from an XML file. | netsh wlan add profile filename="path.xml" |
connect |
Establishes a connection to the specified network | netsh wlan connect name="SSID" |
delete profile |
Deletes a saved network profile. | netsh wlan delete profile name="SSID" |
Using these commands allows you to automate the network configuration process. For example, you can create bat script, which will automatically connect the laptop to the corporate Wi-Fi upon startup, bypassing manual user intervention.
Frequently Asked Questions (FAQ)
Why doesn't the netsh wlan command work?
You most likely ran the command prompt without administrator privileges. Close the window and reopen the console, selecting "Run as administrator." Also, check to see if the "WLAN AutoConfig" service is disabled in the Services Manager.
Is it possible to connect to a hidden network (Hidden SSID)?
Yes, it is possible. You need to add a tag to the profile XML file. <SSID><name>NetworkName</name></SSID> Even if the network is hidden, make sure the security settings are correct. The connection command will work as usual.
How can I find out the password for an already connected network?
Use the command netsh wlan show profile name="NetworkName" key=clearIn the "Security Settings" section, the "Key Contents" field will display the password in clear text.
Does this method work on Windows 11?
Yes, teams netsh are system-wide and fully supported in Windows 10 and 11. The command-line interface remains unchanged, so the instructions are universal for modern OS versions.