How to check password for WiFi networks?

In this article I want to show you how to check password for WiFi networks.

In big companies there is often situation that some guest want to connect to network in office but nobody knows what is the password.
WiFi network profile is always saved on your computer, so there is no problem to gahter all information about it.
Script using netsh command to scan for all WiFi networks cached on your local computer.
Once netsh command is completed, result is parsed and for each of network netsh command is run once again, but this time with information about WiFi password 🙂

Script:

$WifiProfiles = netsh.exe wlan show profiles
$WifiProfiles = $WifiProfiles | Select-String "All User Profile"
$WiFiArray = @()

foreach($profile in $WifiProfiles)
{
    $ProfileName = ($profile -split ": ")[1]
    $ProfileSettings= netsh.exe wlan show profiles name="$ProfileName" key=clear
    $Password = (($ProfileSettings | Select-String "Key Content") -split ": ")[1]
    $AuthenticationType = (($ProfileSettings | Select-String "Authentication") -split ": ")[1]
    
    $object = New-Object PSObject -Property  @{
        "Wifi Profile Name" = $ProfileName
         "Password" = $Password
         "Authentication Type" = $AuthenticationType
                    
   }
   $WiFiArray += $object
}

$WiFiArray

In the result you will receive array with 3 columns like on picutre below.

If there will be open WiFi network of course there will not be any value in password column.
Remember to use script only on your laptop 😉

I hope it will be usefull for some of you 🙂
Enjoy!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.