r-Techsupport / Get-Specs

Windows Specifications script for rTechsupport
GNU General Public License v3.0
6 stars 4 forks source link

Detect if Network Connection profile is Private or Public #138

Closed donjuanal closed 1 year ago

donjuanal commented 1 year ago

Detect if active network interfaces are Private or public with the following code:

Get-NetAdapter | ? {-not $_.Virtual -and $_.Status -eq "Up" } | foreach {Get-NetConnectionProfile -InterfaceAlias $_.Name}

Output resembles this:

Name             : Pretty Fly for a Wi-Fi
InterfaceAlias   : Wi-Fi
InterfaceIndex   : 10
NetworkCategory  : Private
IPv4Connectivity : LocalNetwork
IPv6Connectivity : NoTraffic