Skip to content

Instantly share code, notes, and snippets.

@lewisgibson
Created September 14, 2023 10:42
Show Gist options
  • Save lewisgibson/a28ef9abaf8e125dd31e1227f477273e to your computer and use it in GitHub Desktop.
Save lewisgibson/a28ef9abaf8e125dd31e1227f477273e to your computer and use it in GitHub Desktop.
πŸ“Ά Retrieve and Display Wi-Fi Profile Passwords πŸ”
<#
.SYNOPSIS
This script retrieves Wi-Fi profiles and their associated passwords.
.NOTES
Author: Lewis Gibson
#>
$wifiProfiles = (netsh wlan show profiles) | Select-String "^\s+:\s(.+)$" | ForEach-Object {
$name = $_.Matches.Groups[1].Value.Trim()
$profileInfo = netsh wlan show profile name="$name" key=clear
$pass = ($profileInfo | Select-String "Key Content\s+:\s(.+)$").Matches.Groups[1].Value.Trim()
[PSCustomObject]@{ PROFILE_NAME = $name; PASSWORD = $pass }
}
$wifiProfiles | Format-Table -AutoSize
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment