Run as Administrator:

(netsh wlan show profiles) | Select-String 'All User Profile' | ForEach-Object {
    $profile = ($_ -split ':')[1].Trim()
    $key = (netsh wlan show profile name="$profile" key=clear) | Select-String 'Key Content'
    [PSCustomObject]@{
        SSID = $profile
        Password = if ($key) { ($key -split ':')[1].Trim() } else { '(none)' }
    }
} | Format-Table -AutoSize

Copy output or pipe to Export-Csv for documentation.

Verify

netsh wlan show profile name="YourNetworkName" key=clear | Select-String 'Key Content'

Expected output: Key Content : YourActualPassword


Techworks Blog