[Windows 8] Show passwords of Wi-Fi profiles in clear-text
(netsh wlan show profiles) | # Fetch all Wi-Fi profiles | |
Select-String "\:(.+)$" | # Grab the profile name (note: not necessarily equal to SSID) | |
%{$name=$_.Matches.Groups[1].Value.Trim(); $_} | # Store profile name to a var | |
%{(netsh wlan show profile name="$name" key=clear)} | # Fetch profile details with clear-text password | |
Select-String "Key Content\W+\:(.+)$" | # Grab the password | |
%{$pass=$_.Matches.Groups[1].Value.Trim(); $_} | # Store password to a var | |
%{[PSCustomObject]@{ PROFILE_NAME=$name;PASSWORD=$pass }} | # Construct an object to be able to use Format-Table | |
Format-Table -AutoSize # Format the output | |
Write-Host "" | |
Write-Host "Press any key to continue..." | |
Read-Host |
This comment has been minimized.
This comment has been minimized.
@randomuser1234 Yeah, this was crafted on Windows 8 and haven't tested it on Windows 7 at all. My guess is that some underlying APIs or PowerShell versions are slightly different. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
Is this Windows 8 only? I get an error sometimes on various computers that are Windows 7.
Cannot index into a null array.
At F:\show-wifi-passwords.ps1.ps1:66 char:82
%{(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 }} -erroraction Continue | Format-Table -AutoSize