It's common to need to connect a new device to a wireless network but forget or lose the password. Fortunately, the Windows operating system stores information about previously connected networks in a special storage area accessible to authorized users. Using the command line is one of the fastest and most effective ways to retrieve this information without having to reset the router or search for a sticker on the bottom of the device.
In this article, we will go through the process of recovering your security key in detail. WPA2 or WPA3 Using built-in Windows utilities. You won't need to install any third-party software, as the standard system administrator toolset provides all the necessary capabilities. The main thing is to follow the instructions carefully and have administrator rights on the current computer.
Before you begin entering commands, make sure the device you're working with has previously successfully connected to the target network. If your computer has never connected to the target network, SSID, then there will simply be no saved data in the profile. It's also worth keeping in mind that the methods described below are relevant for modern versions. Windows 10 And Windows 11, where the security policy remains quite strict, but transparent to the owner.
Preparing the command line for work
The first and most important step is to launch the command line interface with the required privileges. Normal user mode will not allow queries to system network profiles, so running as administrator is mandatory. Without this step, the system will return an access error when attempting to view security keys.
To launch, press the key combination Win + X and select "Windows PowerShell (Admin)" or "Command Prompt (Admin)" from the menu. In older versions of the operating system, you can find the application cmd Search the Start menu, right-click, and select the appropriate option. Once the window opens, the title will contain the word "Administrator," confirming the procedure was successful.
⚠️ Caution: Enter commands carefully, checking the syntax. A misspelling of a command name can result in unintended actions, although standard netsh prompts are safe for user data.
The command line interface may seem intimidating to newbies due to the lack of a graphical interface, but it provides direct access to the core network settings. This is where the hidden configuration files, containing the entire connection history. Working in this mode requires precision, as the system doesn't always offer hints if you enter parameters incorrectly.
Viewing a list of saved networks
After successfully launching the console, you should get a list of all wireless networks whose profiles are saved on this computer. This will ensure that the network you need is indeed in the system database. The command for displaying the list is simple and does not require complex parameters.
Type the following command and press Enter:
netsh wlan show profiles
Once completed, you'll see a "User Profiles" section listing all known networks. Note the exact name of the one you're interested in. SSID (network name), as you'll need it for the next step. If the network isn't listed, your computer never connected to it automatically, and you won't be able to recover the password this way.
- 📡 SSID — This is the wireless network ID that is visible when searching for available connections.
- 💾 Profiles are stored locally and do not sync with the cloud without a Microsoft account and sync enabled.
- 🔄 The list may contain both active and old, long-unused connections.
Sometimes the network name may contain spaces or special characters, which will need to be accounted for when forming the next query. The system is case-insensitive, but to avoid errors, it's best to copy the name exactly as it appears in the list or enclose it in quotation marks.
Obtaining the password for a specific network
Now that the network name is known, we can move on to extracting the security key itself. The same utility is used for this. netsh, but with the addition of a parameter requiring the key to be displayed in cleartext. By default, the system hides this data for security reasons.
The command syntax is as follows:
netsh wlan show profile name="Network_Name" key=clear
Replace Network_Name The exact name of your Wi-Fi network, which you found in the previous step. If the name contains spaces, double quotes are required. After running the command, scroll to the "Security Settings" section. We're interested in the "Key Contents" line, which will display the password we're looking for.
| Command parameter | Function Description | Mandatory |
|---|---|---|
name |
Specifies the name of the network profile. | Necessarily |
key=clear |
Requires showing the key in clear text | Necessarily |
Network_Name |
Wireless network SSID | Necessarily |
It's important to note that the key can only be displayed if the current user has administrator rights. Otherwise, the key field may display asterisks or an access denied message. This is a standard operating system security measure. Windows from unauthorized access to confidential information.
What to do if the password is not displayed?
If the "Key Contents" field is empty or hidden, check your access rights. It's also possible that the network profile is corrupted or was created by the system without storing the key (for example, when connecting via WPS without entering a password).
Alternative Method: View All Passwords at Once
It's possible to display information about all saved profiles and their passwords with a single command. This can be convenient for system administrators who need to quickly dump the connection database, but is less convenient for the average user due to the large amount of text on the screen.
The command looks like this:
netsh wlan show profiles key=clear
The result will be a long list where for each network its SSID and the corresponding security key. To avoid scrolling through endless streams of text, you can redirect the output to a text file. This is especially useful if you need to back up all your network settings.
- 📄 Output to a file allows you to easily find the information you need by searching the text.
- 🔍 The command displays not only passwords, but also the encryption type, channel, and other technical details.
- ⚡ Execution speed depends on the number of profiles saved in the system.
To save the report to a file on your desktop, use the command: netsh wlan show profiles key=clear > C:\Users\UserName\Desktop\wifi_passwords.txtThe file path should be adapted to your system and username. This ensures that information is not lost when the console window is closed.
Resetting and managing network profiles
The command line allows you to not only view but also manage profiles. If you've changed the password on your router, the old profile on your computer may be interfering with the connection by attempting to use outdated information. In this case, it's best to delete the profile so the system prompts you for a new key.
To delete a profile, use the command:
netsh wlan delete profile name="Network_Name"
This operation is irreversible for the current user: the saved password will be lost, and you'll have to re-enter it to reconnect. This is a useful feature for clearing out the list of networks you no longer connect to, or for troubleshooting configuration errors when Windows "forgets" to re-enter the password.
⚠️ Note: Deleting a profile does not change the password on the router itself. This action only affects your computer's settings.
Manage profiles via netsh gives you complete control over your network environment. You can rename profiles, export them to XML files for transfer to other computers, or import ready-made configurations. It's a powerful tool in any network specialist's arsenal. IT support.
☑️ Check before deleting your profile
Possible errors and solutions
When working with the command line, users may encounter various errors. These are most often related to typos in the network name or insufficient access rights. Understanding error codes helps quickly diagnose and resolve the problem.
The most common problems:
- ❌ Error 5 (Access Denied): Means that the console is not running as an administrator.
- ❌ Error: Profile not found: The network name is incorrect or the profile has been previously deleted.
- ❌ WLAN service is not running: Windows Network Service has stopped and needs to be started again.
services.msc.
If the command runs but the password is not displayed (it displays "not applicable" or a similar message), this may mean that the network is using a corporate authentication method (such as 802.1x), where the password is not explicitly stored. On home networks with a security type WPA2-Personal such a situation is practically impossible.
It's critical to understand that password recovery is only possible for networks the computer has previously connected to. Hacking other networks using these commands is impossible.FAQ: Frequently Asked Questions
Is it possible to find out a neighbor's Wi-Fi password using CMD?
No, this is not possible. The command line only allows you to view profiles already saved on your computer. To connect to someone else's network, you must know the password in advance or have physical access to the owner's router.
What to do if netsh command is not found?
Utility netsh is a system command and is present in all modern versions of Windows. If the command isn't recognized, check if you opened the command prompt correctly, or try entering the full path: C:\Windows\System32\netsh.exe.
Where are these passwords stored in the system?
Wireless network data is stored in a protected section of the registry and special system files accessible only by the operating system and users with administrator rights. Direct editing of these files is not recommended.
Does this method work on Windows 7 and 8?
Yes, it is a utility. netsh wlan Works identically on Windows 7, 8, 10, and 11. The command syntax has remained unchanged for many years, making this skill universal across OS versions.