Skip to content

Changing the Network Profile in Windows Server 2012

Sometimes I have a virtual machine running Windows Server 2012 and can’t reach some of its services because I allowed their ports only for private networks in the Windows Firewall. Then I see that the network connection has the public profile. This is the easiest way I found to change the profile:

Open a PowerShell with administrator privileges and type

Get-NetConnectionProfile

You should get a list of network interfaces:

Name             : Network
InterfaceAlias   : Ethernet
InterfaceIndex   : 12
NetworkCategory  : Private
IPv4Connectivity : Internet
IPv6Connectivity : NoTraffic

Name             : Network #2
InterfaceAlias   : LAN-Connection
InterfaceIndex   : 17
NetworkCategory  : Public
IPv4Connectivity : LocalNetwork
IPv6Connectivity : NoTraffic

You see that the second network is a public network. Use the InterfaceIndex 17 and enter:

Set-NetConnectionProfile -InterfaceIndex 17 -NetworkCategory Private

Now it is a private network!