Skip to content

Instantly share code, notes, and snippets.

@CybersamuraiDK
Forked from willjobs/wifi-passwords.ps1
Last active November 13, 2025 16:54
Show Gist options
  • Select an option

  • Save CybersamuraiDK/6e0be5c0c47165228895079efa8d98ec to your computer and use it in GitHub Desktop.

Select an option

Save CybersamuraiDK/6e0be5c0c47165228895079efa8d98ec to your computer and use it in GitHub Desktop.
PowerShell script to show all wifi passwords saved in Windows
(netsh wlan show profiles) | Select-String "\:(.+)$" | %{$name=$_.Matches.Groups[1].Value.Trim(); ($details=netsh wlan show profile name="$name" key=clear) -and ($pass=($details | Select-String "Key Content\W+\:(.+)$").Matches.Groups[1].Value.Trim() -or "N/A"); [PSCustomObject]@{PROFILE_NAME=$name;PASSWORD=$pass}} | Format-Table -AutoSize
@ps81frt
Copy link

ps81frt commented Nov 20, 2024

PART 1 : Networking

Get All Stored Wifi-Passwords

1 . Get current basic network Information.

Get-NetIPConfiguration

if that doesnt work !

(netsh wlan show profiles) -match "All User Profile\s*: (.*)" | %{(netsh wlan show profile $_.trim() key=clear)} | Select-String "Key Content" | ForEach-Object {$_ -replace "Key Content\s*: ", ""}

To Display only Keys :

(netsh wlan show profile name=wifi-name key=clear) | Select-String "Key Content" | ForEach-Object { $_.ToString().Split(":")[1].Trim() }

Display only Wifi-Keys

IF IT DOES NOT WORK TRY THESE SIMPLE COMMAND ( Everyone Knows :)

netsh wlan show profile Name=* Key=clear

GET ALL PROFILE NAMES WITH PASSWORDS .

(netsh wlan show profiles) | Select-String "\:(.+)$" | %{$name=$_.Matches.Groups[1].Value.Trim(); $_} | %{(netsh wlan show profile name="$name" key=clear)} | Select-String "Key Content\W+\:(.+)$" | %{$pass=$_.Matches.Groups[1].Value.Trim(); $_} | %{[PSCustomObject]@{ PROFILE_NAME=$name;PASSWORD=$pass }} | Format-Table –AutoSize | Out-String -OutVariable dataCaptured

@hjakovski
Copy link

Microsoft changed something in Win11 25H2. This one should do the job ;-)

Create a list with all WIFI Credentials

$outputFile = "$env:TEMP\wifi_list.txt"
netsh wlan export profile key=clear folder="$env:TEMP"

Get-ChildItem "$env:TEMP\WLAN-*.xml" | ForEach-Object {
$xml = [xml](Get-Content $_.FullName)
$ssid = $xml.WLANProfile.Name
$password = $xml.WLANProfile.MSM.Security.sharedKey.keyMaterial

"SSID: $ssid" | Out-File -FilePath $outputFile -Append -Encoding UTF8
"Passwort: $password" | Out-File -FilePath $outputFile -Append -Encoding UTF8
"------------------------" | Out-File -FilePath $outputFile -Append -Encoding UTF8

Remove-Item $_.FullName

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment