Skip to content

Instantly share code, notes, and snippets.

@maravedi
Created April 14, 2022 14:09
Show Gist options
  • Save maravedi/ee78a308927a9f312f86ab9827c9965e to your computer and use it in GitHub Desktop.
Save maravedi/ee78a308927a9f312f86ab9827c9965e to your computer and use it in GitHub Desktop.
PowerShell one-liner to show Windows network profile categories for saved wireless connections
Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles' | Select -Property * | %{ $Key = $_.PSChildName; $Name = $_.Name -Replace "HKEY_LOCAL_MACHINE","HKLM:"; $Category_Num = Get-ItemPropertyValue "$Name" -Name Category; If($Category_Num -eq 0){ $Category='Public' } ElseIf($Category_Num -eq 1){ $Category='Private' } ElseIf($Category_Num -eq 2){$Category = 'Domain'}; $ProfileName = Get-ItemPropertyValue "$Name" -Name ProfileName; ""|Select @{N='ProfileName';E={$ProfileName}},@{N="ProfileCategory";E={$Category} }} | Sort ProfileCategory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment