On Windows 10/Windows Server 2016/2019, you can manage network connection location from the PowerShell. Run the elevated PowerShell console.
Now use the Get-NetConnectionProfile cmdlet to get a list of network adapters on your computer and their associated network profiles.
In my example, there is only one physical network adapter on a computer with a Public network location type (in the NetworkCategory value, you can see the following types of network profiles: Public, Private or DomainAuthenticated).
Let’s try to change the assigned network profile for the NIC. We need to get the index assigned to this network card. In this example, InterfaceIndex is 8.
Name : Network 2 InterfaceAlias : Ethernet0 InterfaceIndex : 8 NetworkCategory : Public IPv4Connectivity : Internet IPv6Connectivity : NoTraffic
After you get the network adapter index, you can change the network type to Private:
Set-NetConnectionProfile -InterfaceIndex 8 -NetworkCategory Private
Check that the network profile has changed:
Get-NetConnectionProfile -InterfaceIndex 19
The new firewall rules will be applied to the interface according to the assigned network profile without rebooting.
You can also change the network profile for all network adapters of the computer at once:
Get-NetConnectionProfile | Set-NetConnectionProfile -NetworkCategory Private
Original article taken from http://woshub.com/how-to-change-a-network-type-from-public-to-private-in-windows/