DEV Community

Cover image for Change the Network Profile to Public or Private on Windows
Sergio Peris
Sergio Peris

Posted on • Originally published at sertxu.dev

Change the Network Profile to Public or Private on Windows

When you connect a Windows computer to a network, it automatically assings a profile either Public or Private.

This profile defines how the computer can be or not 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 at 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
Enter fullscreen mode Exit fullscreen mode

This command will output something similar to this:

Name             : Red no identificada
InterfaceAlias   : Ethernet0
InterfaceIndex   : 14
NetworkCategory  : Public
IPv4Connectivity : LocalNetwork
IPv6Connectivity : NoTraffic
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

If we check the configuration of the networks again, we will see it changed to Private.

Get-NetConnectionProfile
Enter fullscreen mode Exit fullscreen mode
Name             : Red no identificada
InterfaceAlias   : Ethernet0
InterfaceIndex   : 14
NetworkCategory  : Private
IPv4Connectivity : LocalNetwork
IPv6Connectivity : NoTraffic
Enter fullscreen mode Exit fullscreen mode

Top comments (0)