Updating a Windows Network's Public/Private Status

Windows tries to guess whether a network connection is public or private. Unfortunately, it's wrong a lot of the time. Find out how to use Powershell to update the status manually.

Windows assigns a location type of Public or Private to a network interface based on a number of factors, but it's often wrong. Since this affects what's allowed through the firewall, it's important to know how to update the location type.

The UI varies across versions of Windows, but the Powershell commands are the same, and are often more convenient. To get started, open a Powershell window.

We first need to get the network interface we want to update by running the Get-NetConnectionProfile command.

Get-NetConnectionProfile

It returns a list of network interfaces, and we can see the name and index of the one we want to update.

Name             : Network1
InterfaceAlias   : Ethernet1
InterfaceIndex   : 10
NetworkCategory  : Public
IPv4Connectivity : NoTraffic
IPv6Connectivity : NoTraffic

Name             : Network2
InterfaceAlias   : Ethernet2
InterfaceIndex   : 6
NetworkCategory  : Private
IPv4Connectivity : Internet
IPv6Connectivity : NoTraffic

In the output above, we can see that Network1 is Public with an InterfaceIndex of 10, and Network2 is Private with an InterfaceIndex of 6.

To update the location type, we can use the Set-NetConnectionProfile command with the InterfaceIndex of the network interface we want to update.

The command to update Network1 to Private is:

Set-NetConnectionProfile -InterfaceIndex 10 -NetworkCategory Private

The command to update Network2 to Public is:

Set-NetConnectionProfile -InterfaceIndex 6 -NetworkCategory Public

If we run Get-NetConnectionProfile again, we can see that the location types have been updated:

Name             : Network1
InterfaceAlias   : Ethernet1
InterfaceIndex   : 10
NetworkCategory  : Private
IPv4Connectivity : NoTraffic
IPv6Connectivity : NoTraffic

Name             : Network2
InterfaceAlias   : Ethernet2
InterfaceIndex   : 6
NetworkCategory  : Public
IPv4Connectivity : Internet
IPv6Connectivity : NoTraffic