How to Recover WiFi Passwords with PowerShell and Export to CSV

Ever needed to grab a WiFi password from a laptop you’re about to hand off, or just want a backup of all your saved network keys? Maybe you’re setting up a new device and can’t remember the password your roommate typed in months ago. If you’re on Windows and comfortable with a little command-line action, PowerShell can pull every stored WiFi profile and its password in seconds. By the end of this guide, you’ll have a single CSV file listing all your Wi-Fi networks with their SSID and password, ready to import into a spreadsheet or password manager.


This tutorial assumes you have basic Windows admin rights (you’ll need to run PowerShell as Administrator) and a handful of networks saved on your machine. No crazy coding skills required — just copy, paste, and run. Let’s dive in.


What You’ll Need


  • A Windows computer (Windows 10 or 11 works best)
  • Administrator access to that computer
  • PowerShell (comes with Windows, no extra install)
  • A folder to save your CSV file (e.g., Desktop or Documents)
  • Optional: a text editor like Notepad if you want to tweak the script


Step 1: Open PowerShell as Administrator


Click the Start button, type “PowerShell”, right-click on “Windows PowerShell”, and select “Run as administrator”. A blue window will pop up — this is your command center. If you get a User Account Control prompt, click Yes.


wifi password recovery powershell to csv Windows Start menu right-click PowerShell Run as administrator

Step 2: List All Saved WiFi Profiles


First, let’s see what profiles are stored. Type the following command and press Enter:


netsh wlan show profiles


You’ll see a list of all user profiles. Note the exact names of the networks you care about. Some might be funny or truncated, so copy them down if needed.

Step 3: Extract a Single WiFi Password (Test Run)


Before we script a bulk export, let’s verify it works on one network. Replace “YourNetworkName” with the actual SSID from step 2 and run:


netsh wlan show profile name=”YourNetworkName” key=clear


Look for the line that says “Key Content” — that’s your password in plain text. If you see it, you’re golden.


wifi password recovery powershell to csv PowerShell output showing Key Content with password for a WiFi profile

Step 4: Write the PowerShell Script to Export All Profiles to CSV


Now we’ll automate the process. Type or copy-paste the following multi-line command into PowerShell (you can paste by right-clicking in the window):


$profiles = netsh wlan show profiles | Select-String “All User Profile” | ForEach-Object { ($_ -split “:”)[1].Trim() }
$passwords = @()
foreach ($profile in $profiles) {
$details = netsh wlan show profile name=”$profile” key=clear
$password = ($details | Select-String “Key Content”) -replace “.*: “, “”
$passwords += [PSCustomObject]@{ SSID = $profile; Password = $password }
}
$passwords | Export-Csv -Path “$env:USERPROFILEDesktopWiFiPasswords.csv” -NoTypeInformation


This script collects every profile, extracts the password (handling networks without a password gracefully), and saves the result as a CSV file on your Desktop. Press Enter to run it.


wifi password recovery powershell to csv PowerShell window with multi-line script and subsequent CSV export output

Step 5: Open Your CSV File


Navigate to your Desktop. You’ll see a file named “WiFiPasswords.csv”. Double-click it to open in Excel or Notepad. If Excel opens, you might see a security warning — just click Enable. You’ll have two columns: SSID and Password. Congratulations, you’ve successfully recovered all your WiFi passwords.


wifi password recovery powershell to csv Excel spreadsheet showing SSID and Password columns from exported CSV file

Common Pitfalls


  • **PowerShell not running as Administrator**: If you skip the admin step, you’ll get errors like “Access is denied” or no Key Content shows up. Always right-click and select “Run as administrator”.
  • **Network profile names with spaces or special characters**: The script above should handle them, but if you manually type a profile name, enclose it in quotes. If a profile name contains double quotes, it might break — use the script approach instead.
  • **No WiFi profiles saved**: If you get an empty CSV, it means your computer hasn’t saved any WiFi networks (or the profiles are stored under a different user account). Try running the command as the same user who connected to the networks.


Where to Next?


Now that you’ve got your WiFi passwords in a neat CSV, you can use them for a password manager, share them with a family member, or keep them as a backup. If you prefer a more visual approach, check out our guide on how to recover wifi password on windows using the GUI. For those who like command-line scripts, our wifi password recovery command line script guide has more tricks. And if you’re traveling and need to retrieve a password from a hotel network, our wifi password recovery for home users and how to recover wifi password without internet posts have you covered. Happy networking!

Leave a Reply

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