Skip to content

Instantly share code, notes, and snippets.

@ahpooch
Created June 9, 2025 22:28
Show Gist options
  • Select an option

  • Save ahpooch/b51db16d07b3c0fd8bdf67fdd7996167 to your computer and use it in GitHub Desktop.

Select an option

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.
$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