When you connect a Windows computer to a network, it automatically assigns a profile, either Public or Private.
This profile defines how the computer can or cannot be reached from the network by other devices, and the resources it exposes to the network. Also affects the firewall configuration, so an app might be able to access or be exposed on a private network but no at a public network.
Change the Network Profile using PowerShell
You can change the Network Profile following the next steps.
First, we need to know the InterfaceIndex we want to change its profile.
Get-NetConnectionProfile
This command will output something similar to this:
Name : Red no identificada
InterfaceAlias : Ethernet0
InterfaceIndex : 14
NetworkCategory : Public
IPv4Connectivity : LocalNetwork
IPv6Connectivity : NoTraffic
As we can see, the InterfaceIndex is 14.
So now we can change its profile to either Public or Private.
The network profile was Public, so we’re changing it to Private.
Set-NetConnectionProfile -InterfaceIndex 14 -NetworkCategory Private
If we check the configuration of the networks again, we will see it changed to Private.
Get-NetConnectionProfile
Name : Red no identificada
InterfaceAlias : Ethernet0
InterfaceIndex : 14
NetworkCategory : Private
IPv4Connectivity : LocalNetwork
IPv6Connectivity : NoTraffic