## Get previously connected WiFi SSIDs and non-blank passwords
$SSIDs = netsh wlan show profiles|where { $_ -match '^\s*All User Profile\s*:\s*(.*)$' } | % { $matches[1] }
$SSIDs | %{ if( $m = ( netsh wlan show profile name="$_" key=clear |sls "key content\s*:\s*(.*)$")) { [pscustomobject]@{ SSID = $_ ; Password = $m.matches.Groups[-1].value }}}|sort ssid