Created
September 14, 2023 10:42
-
-
Save lewisgibson/a28ef9abaf8e125dd31e1227f477273e to your computer and use it in GitHub Desktop.
Revisions
-
lewisgibson created this gist
Sep 14, 2023 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ <# .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