Skip to content

Instantly share code, notes, and snippets.

@jay-chorus
Last active June 8, 2022 13:44
Show Gist options
  • Save jay-chorus/d2a650bb4e48726b236c3a86857599d9 to your computer and use it in GitHub Desktop.
Save jay-chorus/d2a650bb4e48726b236c3a86857599d9 to your computer and use it in GitHub Desktop.
Quickly get passwords for all wifi access points on a PC
$listProfiles = netsh wlan show profiles | Select-String -Pattern "All User Profile" | %{ ($_ -split ":")[-1].Trim() };
$listProfiles | foreach {
$profileInfo = netsh wlan show profiles name=$_ key="clear";
$SSID = $profileInfo | Select-String -Pattern "SSID Name" | %{ ($_ -split ":")[-1].Trim('"',' ') };
$Key = $profileInfo | Select-String -Pattern "Key Content" | %{ ($_ -split ":")[-1].Trim() };
[PSCustomObject]@{
ProfileName = $SSID;
Password = $Key
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment