Last active
September 12, 2015 19:57
-
-
Save harriha/11332150 to your computer and use it in GitHub Desktop.
[Windows 8] Show passwords of Wi-Fi profiles in clear-text
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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 |
@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
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