Change Hyper-V Network Category from Public to Private using Powershell

Hyper-V Server 2012 R2 Set Network from Public to Private
Hyper-V Server 2012 R2 Set Network from Public to Private

Recently I was working on a guide to build an all-in-one firewall/ router, shared ZFS storage and virtual machine host using Hyper-V Server 2012 R2 as a host. Upon installing the Microsoft Hyper-V Server 2012 R2 one has many network settings automatically configured, including setting up NICs with DHCP. The standard blue “Server Configuration” screen allows one to quickly make some basic changes such as installing updates, changing date and time, and setting network adapter addresses and DNS servers. There is even an option (7) to enable remote desktop so one can work over an RDP connection rather than utilizing KVM over IP for server setup. For those that have used both, RDP is much easier to work in. Enabling Remote Desktop using the prompts on #7 of the option screen might make one think that it is therefore possible to connect immediately via an RDP client. Due to a Microsoft security setting, this does not work.

Hyper-V Server 2012 R2 Remote Desktop Enabled
Hyper-V Server 2012 R2 Remote Desktop Enabled

For anyone familiar with Windows networking post Windows Vista and Server 2008, there is a concept of a network being “Public” or “Private”. The idea stems largely from the notion that Public networks are encountered often by mobile users who are using laptops and tablets at coffee shops and other public forums. The quick way to conceptualize Public versus Private is that Microsoft makes the default network type Private and then adds some security settings atop the Public network to try keeping the machine secure. One of those settings is to block remote desktop sessions.

Moving to Hyper-V Server 2012 R2, one may think that if that Option 7 is selected, and Remote Desktop is enabled, remote desktop would be enabled on the Public network. This is not the case and causes frustration for many first time Hyper-V users. The fix is very easy:

Hyper-V Server 2012 R2 Set Network from Public to Private
Hyper-V Server 2012 R2 Set Network from Public to Private

In this example a PowerShell command prompt was opened. If you do not see PS in front of the prompt, you can simply type “powershell” into a standard command prompt and it will open up Windows PowerShell.

Get-NetConnectionProfile was typed into the command prompt. This brought up a list of active interfaces. Since this is a Supermicro A1SRi-2758F with a quad network adapter, I left only one network connection attached to make this example easy to follow. One can see the InterfaceIndex value of 13 which identifies the active network adapter. The other thing we see is a NetworkCategory of Public. This is why remote desktop is not working. We issue one simple command using that 13 in: “Set-NetConnectionProfile -InterfaceIndex 13 -NetworkCategory Private” and after a half second or so we are all set. Typing Get-NetConnectionProfile again shows us we now have a Private network and remote desktop is working again.

Hopefully this helps. There are a bunch of guides but realistically this is a 15 second issue to fix if you have command line/ powershell access:

  • Use Get-NetConnectionProfile to find the InterfaceIndex #X
  • Set-NetConnectionProfile -InterfaceIndex X -NetworkCategory Private
  • Verify using Get-NetConnectionProfile again



  1. This fixed my problem straightaway I’m using hyper V on Windows 10 I did reboot though after applying the powershell commands

  2. Awesome. Been driving me nuts on why I couldn’t connect to a remote HyperV server. Narrowed it down to the firewall. Started turning on each firewall profile. Found it was Public. Then found this page. Changing the network connection type to Private cured the issue without having to change any firewall rules.

  3. Do you have to do this PowerShell change on both the host and the VM? The Internal Switch network shows as public on both the host and the VM.

  4. There is a fix available from MS: KB4482887 fixed it: “Addresses an issue with Remote Desktop access to Hyper-V Server 2019.”


Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.