Skip to content

Instantly share code, notes, and snippets.

@mattou07
Created November 17, 2022 15:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattou07/a8f4ab8ed75bf27207929d8a7b2d8422 to your computer and use it in GitHub Desktop.
Save mattou07/a8f4ab8ed75bf27207929d8a7b2d8422 to your computer and use it in GitHub Desktop.
A small script to list your wifi profiles and retrieve the password if present
$netshResult = &netsh wlan show profile
$wifiList = @()
foreach($t in $netshResult){
$line = $t -split(":")
if($line[1]){
$wifiList += $line[1].substring(1)
}
}
for($i=0; $i -le $wifiList.Length-1; $i++)
{Write-Host "$i "$wifiList[$i]}
$SSID = Read-Host -Prompt "Please pick the SSID you need"
$choice = $wifiList[$SSID]
&netsh wlan show profile name=$choice key=clear
$Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment