Use powershell to show all wifi passwords stored on a machine

Use the script below to show all wifi passwords stored on a Windows 7/8/10 machine.

To save it as a script to use later - give the extension .ps1 e.g.
wifipasswords.ps1

(netsh wlan show profiles) | Select-String "\:(.+)$" | %{$name=$_.Matches.Groups[1].Value.Trim(); $_} | %{(netsh wlan show profile name="$name" key=clear)}  | Select-String "Key Content\W+\:(.+)$" | %{$pass=$_.Matches.Groups[1].Value.Trim(); $_} | %{[PSCustomObject]@{ WiFi_SSID=$name;PASSWORD=$pass }} | Format-Table -AutoSize