Created
June 9, 2025 22:28
-
-
Save ahpooch/b51db16d07b3c0fd8bdf67fdd7996167 to your computer and use it in GitHub Desktop.
Snippet to get Wi-Fi Profiles in form of an array of PSCustomObjects.
This file contains hidden or 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 characters
| $ProfilesRaw = netsh wlan show profiles | |
| $results = $ProfilesRaw | Select-String '^ *(?<profilescope>.+): (?<profilename>.*)$' -AllMatches | |
| $Profiles = @() | |
| for ($i=0; $i -lt $results.count; $i++) { | |
| $Profiles += [PSCustomObject]@{ | |
| Name = $results.Matches[$i].Groups['profilename'].Value | |
| Scope = $results.Matches[$i].Groups['profilescope'].Value | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment