# encoding: ascii
# api: powershell
# title: Get-WifiProfiles
# description: Uses netsh command to get all the computer’s wifi profiles (including clear text passwords)
# version: 0.1
# type: function
# author: CrazyDave
# license: CC0
# function: Get-WifiProfiles
# x-poshcode-id: 4520
# x-archived: 2017-03-18T05:33:14
# x-published: 2014-10-15T17:01:00
#
#
function Get-WifiProfiles {
$tmpFolder = Join-Path $env:temp ([Guid]::NewGuid().ToString().Replace('-',''))
mkdir $tmpFolder | Out-Null
netsh wlan export profile key=clear folder=$tmpFolder | Out-Null
gci $tmpFolder\*.xml | % {
$data = [xml] (gc $_)
New-Object PSObject -Property @{
Name = $data.WLANProfile.name
SSID = $data.WLANProfile.SSIDConfig.SSID.name
ConnType = $data.WLANProfile.connectionType
ConnMode = $data.WLANProfile.connectionMode
AuthType = $data.WLANProfile.MSM.security.authEncryption.authentication
Encryption = $data.WLANProfile.MSM.security.authEncryption.encryption
KeyType = $data.WLANProfile.MSM.security.sharedKey.keyType
Key = $data.WLANProfile.MSM.security.sharedKey.keyMaterial
}
}
#Clean Up
ri -Force -Recurse -Path $tmpFolder
}