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
***output***
Profiles on interface Wi-Fi:
Group policy profiles (read only)
---------------------------------
<None>
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
***output*** Profilemywifion interface Wi-Fi: ======================================================================= Applied: All User Profile Profile information -------------------Version: 1Type : Wireless LANName :mywifiControl options :Connection mode : Connect automaticallyNetwork broadcast : Connect only if this network is broadcastingAutoSwitch : Do not switch to other networksMAC Randomization : DisabledConnectivity settings ---------------------Number of SSIDs : 1SSID name : "mywifi"Network type : InfrastructureRadio type : [ Any Radio Type ]Vendor extension : Not presentSecurity settings -----------------Authentication : WPA2-PersonalCipher : CCMPAuthentication : WPA2-PersonalCipher : GCMPSecurity key: PresentKey Content : 098745632145Cost settings -------------Cost : UnrestrictedCongested : NoApproaching Data Limit : NoOver Data Limit : NoRoaming : NoCost 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]
}
$profilePropList+=$PropItem
}
}
}
$profilePropList
}
#Calling the function
Get-WirelessProfilePassword | where {$_.Category -eq "Key Content" -or $_.Property -eq "SSID Name"} | select Profile, Category, Property
Result:
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
Fantastic,now i am able to retrieve all my saved wifi passwords..
Thanks jeffi…