Skip to content

Instantly share code, notes, and snippets.

@rsha256
Last active August 15, 2022 10:30
Show Gist options
  • Save rsha256/17e0ee8850ee30800357d7579eae7971 to your computer and use it in GitHub Desktop.
Save rsha256/17e0ee8850ee30800357d7579eae7971 to your computer and use it in GitHub Desktop.
A powershell script I made to make showing WiFi passwords easier
$location = Read-Host "Do you want detailed info? (you really don't) [Y/n] "
If (($location -eq "yes") -or ($location -eq "Yes") -or ($location -eq "Y") -or ($location -eq "y"))
{
netsh wlan show profiles
$networkName = Read-Host 'Which of the above is the wifi network that you want to know the password of?'
netsh wlan show profile name=`"$networkName`" key=clear
Write-host "The Key Content (under Security settings) is the wifi password! Thanks for using this script!"
Write-host "If you see: " -NoNewline; Write-Host "Key Index : 1" -ForegroundColor Green -BackgroundColor Black -NoNewline; Write-Host " instead of Key Content, then your network has no password.";
}
Elseif (($location -eq "no") -or ($location -eq "No") -or ($location -eq "N") -or ($location -eq "n"))
{
netsh wlan show profiles
$networkName = Read-Host 'Which of the above is the wifi network that you want to know the password of?'
netsh wlan show profile name=`"$networkName`" key=clear | find "Key Content"
Write-host "Here is the wifi password! Thanks for using this script!"
Write-host "If nothing was returned then you either typed something in wrong or the network has no password."
}
Else
{
Write-Host -BackgroundColor Black -ForegroundColor Red "INVALID ENTRY! Please try again."
}
Write-Host -NoNewLine 'Press any key to exit...';
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');
@rsha256
Copy link
Author

rsha256 commented Aug 31, 2020

v2.1:

. { iwr -useb https://gist.githubusercontent.com/rsha256/17e0ee8850ee30800357d7579eae7971/raw/0763db91ea5b0c75c42e859b07e1a27a2f4859c1/show-wifi.ps1 } | iex;

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