How to find out your computer's Wi-Fi password using the command line: 3 proven methods

Have you forgotten your home Wi-Fi password and there's no sticker with the factory settings on your router? Or do you need to connect a new device but can't be bothered to look for the paper with the access code? Luckily, if your computer is already connected to the network, the password can be easily retrieved using Windows command line — without installing third-party programs and even without administrator rights (in most cases).

In this article we will look at three working methods, including hidden features netsh, exporting Wi-Fi profiles to a file, and an alternative method using PowerShell. You'll also learn how to bypass common errors (such as "Access Denied") and why some networks may not display their password. These instructions are relevant for Windows 10 And Windows 11, but some commands also work on older versions of the system.

Before you begin: If you're not the only user of the computer, make sure you have permission to view the network settings. In corporate networks, passwords are often encrypted by security policies, and their retrieval may be blocked.

📊 How often do you forget your Wi-Fi password?
Once a month
Only after resetting the router
I never forget
I store it in a password manager.

1. The main method: command netsh wlan show profile

This is the most universal method, working on 90% of home networks. It doesn't require administrator rights as long as your account has access to the Wi-Fi profile (meaning you've connected to this network at least once).

Open command line (Win + R → enter cmdEnter) and perform in order:

netsh wlan show profiles

On the list User Profiles Find your network name (SSID). Then enter:

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

Replace NETWORK_NAME to the actual name of your Wi-Fi (in quotes!). In the results, look for the line Key Contents - this is the password.

Make sure your computer is connected to the target Wi-Fi network.

Check the case of the letters in the network name (SSID)

Close your VPN if it is active (it may block network commands)

Be prepared to enter commands without spaces before/after "="-->

⚠️ Attention: If you see a blank line or the message "Access Denied" instead of a password, the network profile is protected by group policies (often seen in office networks). Try the methods in Section 3 or run CMD as administrator (Win + XTerminal (administrator)).

2. Export all Wi-Fi passwords to a file (for backup)

This method is useful if you need to save passwords from everyone networks the computer has ever connected to. The command will create an XML file with full profile data, including security keys.

Enter in the command line:

netsh wlan export profile key=clear folder="C:\WiFi_Passwords\"

Files with extension .xml will appear in the folder C:\WiFi_Passwords\. Open the desired file with any text editor (for example, With a notepad) and find the tag <keyMaterial> - there will be a password inside it.

Command parameter Description Example of meaning
key=clear Show passwords in cleartext Without this parameter, passwords will be encrypted.
folder="..." Folder for saving XML files folder="D:\Backup\WiFi\"
name="..." Export only one profile name="MyWiFi_5G"

If the folder doesn't exist, the command will create it automatically. Just make sure your account has write access to the specified directory (e.g. C:\ often requires admin rights).

What to do if XML files won't open?

If you see hieroglyphs when opening XML, it means the file is saved in UTF-16 encoding. Use Notepad++ or VS Code for correct display. Alternatively, you can convert the file via PowerShell using the command:

Get-Content "C:\WiFi_Passwords\*.xml" | Set-Content -Encoding UTF8 "converted.xml"

3. Alternative Method: PowerShell for Hidden Networks

Sometimes networks are not displayed in the standard list netsh - for example, if they were connected via WPS or hidden in the router settings. In this case, PowerShell with module NetAdapter.

Run PowerShell as administrator (Win + XWindows PowerShell (Administrator)) and run:

(Get-NetAdapter -Name "Wi-Fi" | Get-NetConnectionProfile).Name

This command will display the name of the current connection. Then enter:

$profile = Get-NetConnectionProfile -Name "NETWORK_NAME"

$password = (Get-NetAdapter -InterfaceDescription "$($profile.InterfaceAlias)" | Get-NetAdapterAdvancedProperty -RegistryKeyword "NetworkAddress").RegistryValue

Write-Host "Password: $password"

If you see an error "Property not found", then the password isn't stored in the registry in clear text. In this case, the only option is to reset the router settings or use specialized utilities like WirelessKeyView (but they require administrator rights).

4. Common mistakes and how to fix them

Even simple commands can fail. Here are the most common issues and their solutions:

  • 🔴 "Access Denied" → Run CMD/PowerShell as administrator or check the folder permissions (for XML export).
  • 🔴 "Profile not found" → Make sure the network name is entered exactly (case-sensitive and spaces-sensitive). Try the command netsh wlan show interfacesto see your current connection.
  • 🔴 "Key content is missing" → The password is not saved in the system (for example, if the connection was through WPS or guest access).
  • 🔴 "Invalid syntax" → Check the quotation marks in the command. In Russian-language versions of Windows, they are sometimes necessary. «» instead of "".

If you are connected to the network via VPN or proxy, temporarily disable them - they may block command line network requests. Also, make sure the service WLAN AutoConfig launched (checked in services.msc).

⚠️ Attention: In corporate networks (for example, in offices or universities), passwords are often stored in encrypted form and linked to a domain account. Extracting them through netsh This will be impossible without domain administrator rights. In such cases, please contact your organization's IT department.

5. Security: Who else can see your password?

Extracting your password via the command line is convenient, but it's not secure. Here's who could potentially access your network data:

  • 🖥️ Other users of this computer - if they have access to your account or know the administrator password.
  • 🔍 Malicious software — Some viruses scan the command line for network commands and steal passwords.
  • 📡 Network neighbors - if you exported XML files to a shared folder (for example, a network drive).
  • 🔧 Technical support services - when connecting remotely to your PC, they can view the command history.

To minimize risks:

  1. Delete XML files with passwords after use (del C:\WiFi_Passwords\*.xml).
  2. Use clear in CMD after extracting the password to clear the command history.
  3. Set up BitLocker or encrypt folders if you store backup copies of profiles.

6. What to do if none of the methods worked?

If all the above methods have not yielded results, the reasons may be as follows:

  1. The password is not saved in the system. - for example, if you connected via WPS (button on the router) or guest access without entering a password.
  2. The network uses Enterprise authentication. (802.1X) - these profiles do not show the password in clear text.
  3. The profile is damaged — try deleting the network in Windows settings and connecting again.
  4. Group Policy Limitations — in domain networks, administrators can block access to passwords.

In these cases, the following options remain:

  • 🔄 Reset the router - press the button Reset on the back panel (hold for 10 seconds). The password will be reset to the factory default (indicated on the sticker).
  • 📡 Connect to the router via cable - go to the web interface (usually 192.168.0.1 or 192.168.1.1) and look at the password in the Wi-Fi settings.
  • 🔧 Use third-party utilities - For example, WirelessKeyView from NirSoft (requires administrator rights).
⚠️ Attention: Resetting the router will return All factory settings - including network name, password, provider binding, and firewall rules. If you have configured PPPoE, IPTV or port forwarding, they will need to be reconfigured. Before resetting, back up your configuration using the router's web interface.

FAQ: Frequently Asked Questions

Is it possible to find out the password for a Wi-Fi connection that another computer on the network has connected to?

No, unless you have physical or remote access to that computer. Wi-Fi passwords are stored locally on each device and are not transmitted over the network. The exception is if the network uses WPS or vulnerable to attacks like WPA2 Handshake (but this requires special skills and is often illegal).

Why in the results netsh asterisks are displayed instead of the password ()?

This means the password is saved, but not displayed in plaintext due to security policy. Try this:

  1. Run CMD as administrator.
  2. Use the PowerShell method from section 3.
  3. Export profile to XML (section 2) - sometimes the password is visible there.

If all else fails, the password is most likely protected at the system level (for example, in corporate networks).

Does this method work on Mac or Linux?

No, teams netsh And Get-NetConnectionProfile — these are tools exclusively for Windows. For macOS use the command:

security find-generic-password -wa "NETWORK_NAME"

On Linux (if the network is managed NetworkManager):

sudo grep psk= /etc/NetworkManager/system-connections/"NETWORK_NAME"

On Android (with root rights) passwords are stored in /data/misc/wifi/WifiConfigStore.xml.

Is it possible to find out my neighbor's Wi-Fi password?

Technically yes, but that's illegally In most countries (including Russia, Article 272 of the Russian Criminal Code, "Unauthorized access to computer information"). Even if the network is poorly secured, connecting without the owner's permission is considered hacking. The ethical and legal risks are not worth the internet savings.

If you really need access, ask your neighbor for a guest password or set up repeater with his permission.

How can you protect your Wi-Fi from this type of hack?

To make it more difficult to extract passwords from connected devices:

  • 🔒 Use WPA3 instead of WPA2 (if the router supports it).
  • 🔄 Change your password regularly (every 3-6 months).
  • 📵 Turn off WPS in the router settings - this protocol is vulnerable to brute-force attacks.
  • 👤 Set up guest network with a separate password for temporary devices.
  • 🛡️ Enable filtering by MAC addresses (although this is not a panacea).

It is also useful to disable the broadcast SSID (hide the network name), but this will create inconvenience for legitimate users.