How to Easily Change Network Card Profile / Network Location (Private or Public) on Windows Server 2012 R2
Network Location Awareness (NLA) is a feature offered on Windows Server 2012 R2 and all Windows workstation editions from Windows 8.1 and above, including Windows 10. When connecting to a network (LAN or Wireless) it is often misidentified as a Public network instead of a Private network or vice versa. The same problem is also seen when adding an additional network card to a Windows 2012 server. This article explains how to use Windows PowerShell to quickly change any Network Card identification between a Public or Private Network and ensure the correct Firewall rules are applied (if in use).
The screenshot below shows our Windows 2012 R2 server configured with two network cards. We’ve renamed the network cards to easily identify them, as such Ethernet0 was renamed to “Ethernet0 – WAN Adapter”, while Ethernet1 was renamed to “Ethernet1 – LAN Adapter”.
The Windows Network Location Awareness (NLA) has incorrectly identified Ethernet0 to be connected to a Private network, while Ethernet1 is also incorrectly identified to be connected to a Public network, as shown below:
Figure 1. Windows Network Location Awareness (NLA) incorrectly identifies the Private & Public networks on our network interface cards
We should note that incorrect network profiles (Private or Public) also means that the Windows Firewall is applying the incorrect rules to the network cards. For example, a Public network could have very strict rules configured, while the Private network might have less restrictive rules applied. As one can understand, this also creates a serious security hole and therefore the correct network profiles (Private or Public) must be applied to each network interface card (network adapter).
Quickly Change Network Profiles (Public or Private) via PowerShell
To begin, launch the Windows PowerShell console by click on the PowerShell icon located on the taskbar:
Figure 2. Launching the Windows PowerShell console
Next, at the prompt enter the command Get-NetconnectionProfile to obtain a list of all network interfaces on the Windows Server, along with their identified network category (Private / Public):