In this post, we will see how to view all the wireless profiles and WiFi passwords which are saved in the computer.

When a computer is connected to a wireless network, a profile is created with all the wireless network parameters and password. This details can be viewed in command prompt by looking into “netsh”

netsh command to view the profile names

C:\Users\MyPC>netsh wlan show profiles

Profiles on interface Wi-Fi:
Group policy profiles (read only)
User profiles
    All User Profile : mywifi 
    All User Profile : mywifi2

netsh command to view profile details

C:\Users\MyPC>netsh wlan show profiles name="mywifi" key=clear

Profile mywifi on interface Wi-Fi:

Applied: All User Profile

Profile information
    Version                : 1 
    Type                    : Wireless LAN 
    Name                    : mywifi
    Control options         : 
       Connection mode      : Connect automatically 
       Network broadcast    : Connect only if this network is broadcasting 
       AutoSwitch           : Do not switch to other networks 
       MAC Randomization    : Disabled

Connectivity settings
    Number of SSIDs         : 1 
    SSID name               : "mywifi" 
    Network type            : Infrastructure 
    Radio type              : [ Any Radio Type ] 
    Vendor extension        : Not present

Security settings
    Authentication          : WPA2-Personal 
    Cipher                  : CCMP 
    Authentication          : WPA2-Personal 
    Cipher                  : GCMP 
    Security key           : Present 
    Key Content             : 098745632145

Cost settings
    Cost                    : Unrestricted 
    Congested               : No 
    Approaching Data Limit  : No 
    Over Data Limit         : No 
    Roaming                 : No 
    Cost Source             : Default

To view the profile password, we have to issue the command seperately and the output is in plain text.

Below PowerShell script generate full details of all wireless profiles in the computer

function Get-WirelessProfilePassword
    $ProfileNames = @()
    $profilePropList = @()
    #Get all the wlan profiles
    $wLAN_Profiles = & netsh wlan show profiles

    #Extract the profile names to the list
    $wLAN_Profiles | % {$ProfileNames += if($_.split(":")[1]){($_.split(":")[1]).trim()}}

    #looping through the profile names to get the profile parameters
    foreach($profileName in $ProfileNames){
        #generating the command for profile parameter
        $command = '& netsh wlan show profiles name="' + $profileName + '" key=clear'
        #invoking the command
        $profileProp = Invoke-Expression $command

        #looping though the result and processing the text to list of PSCustom object class
        foreach($prop in $profileProp) {
            if(!($prop.split("+:")[1]) -and ($prop.split("+:")[0] -notmatch "----")){
                $type = $prop.split("+:")[0]
            if(!($prop.split("+:")[0] -match "----") -and ($prop.split("+:")[0] -ne $type)){ 
                $PropItem = New-Object PSObject -Property @{
                    Profile = $profileName
                    Type = $type.trim()
                    Category = $prop.split("+:")[0].trim()
                    Property = $prop.split("+:")[1]

#Calling the function
Get-WirelessProfilePassword | where {$_.Category -eq "Key Content" -or $_.Property -eq "SSID Name"} | select Profile, Category, Property


Profile  Category    Property  
-------  --------    --------  
mywifi   Key Content  098745632145
mywifi2  Key Content  easypassword

The result is a list of PSObjects which is easy to sort, filter and to pass on to other powershell codes.

Thank you for reading my post. Hope this is helpful to you