86

After a restart of one of our servers (a Windows Server 2012 R2), all private connections become public and vice versa (this user had the same problem). Stuff like pinging and iSCSI stopped working, and after some investigation it turned out this was the cause.

The problem is that I don't know how to make them private again. Left-clicking the network icon in the tray shows the "modern" sidebar, but it only shows a list of connections, and right-clicking them doesn't show any options.

What could be the problem, and is there a way to change these settings? I have to make one of the connections public (Internet access), and two of them private (backbone).

  • For anyone just needing to set a network from public to private (or vice versa), this works all the way up through Windows Server 2019 riptidehosting.com/blog/… - It won't address your deeper issues though. – TylerH Feb 17 '19 at 17:53
84

Powershell. Here is an example of changing the network profile of a network interface called Ethernet1 from whatever it is now to "Private." I got this info from Get-Help Set-NetConnectionProfile -Full.

PS C:\>$Profile = Get-NetConnectionProfile -InterfaceAlias Ethernet1

PS C:\>$Profile.NetworkCategory = "Private"

PS C:\>Set-NetConnectionProfile -InputObject $Profile

Documentation: https://technet.microsoft.com/en-us/library/jj899566(v=wps.630).aspx

| improve this answer | |
  • 2
    Thanks a lot! This saved me. One tiny correction (the TechNet article for Set-NetConnectionProfile also has this typo): Private should be a string in the second line, i.e. $Profile.NetworkCategory = "Private" is correct. The same goes for the connection name ("Ethernet1"). – Groo Oct 23 '14 at 12:56
  • I have created a script that does this for all connection profiles including ones that aren't currently active yet: gist.github.com/CMCDragonkai/dbd2d94840cdaf79d3f6964bbd58e92f – CMCDragonkai Feb 4 '17 at 10:06
  • Thanks for a proper solution that doesn't open up RDP on any unknown network. – Florian Heigl Apr 7 '17 at 19:11
  • techman's answer shows how to do the same thing with a more elegant one-liner: Set-NetConnectionProfile -InterfaceAlias Ethernet1 -NetworkCategory Private – mwfearnley Mar 28 '18 at 11:57
  • Works great at Windows Server 2016 Standard – Can YILDIZ Nov 25 '19 at 13:46
51

A GUI way of making this change:

  1. Hit Winkey + R to open Run prompt and type gpedit.msc
  2. Navigate to: Computer Configuration/Windows Settings/Security Setting /Network List Manager Policies.
  3. Choose your Network name in the right pane.
    Note: To show networks not currently connected, right-click Network List Manager Policies in the left pane and choose Show All Networks.
  4. Go to Network Location tab and change the Location type from Public to Private. enter image description here

  5. Close Local Policy Editor.

Source: https://social.technet.microsoft.com/Forums/lync/en-US/82ccc68c-947e-435a-a237-1090f38d0dbe/windows-server-2012-r2-datacenter-network-stuck-in-public-mode

| improve this answer | |
  • How do I set network as Domain Network? – Krunal Sep 27 '18 at 13:57
  • You can't manually change a network to a domain network. Once you join the machine to a domain it will set the network as Domain Network. – Gabriel Graves Nov 2 '18 at 6:42
33

Using Powershell. Here is an example of changing the network profile of a network interface called Ethernet to "Private." This is a one line command.

Set-NetConnectionProfile -InterfaceAlias Ethernet -NetworkCategory Private

This will work on any local computer with Powershell installed.

| improve this answer | |
  • This is basically what the accepted answer states, right? – Groo Aug 27 '15 at 17:05
  • 7
    This command does not require a variable. One line and done. It is an improved command. – techman Aug 27 '15 at 17:13
  • Also, The reason I discovered this command is because the accepted answer does not work for me. This command sets the connection type directly without discovery. – techman Aug 27 '15 at 18:29
  • 1
    It does BTW not work on Windows 7, this comandlet is introduced in 2012/8. – eckes May 29 '17 at 11:47
  • 2
    Use: get-NetConnectionProfile to check current status and names of your interfaces. – Tilo Jan 19 '18 at 19:18
4

I've had a similar issue for months on my home 2012R2 Domain Controller.

After patching and a reboot I could not connect via RDP.

I have MS firewall turned off in GPO for domain networks. After not being able to connect I found that the primary Ethernet connection was listed as public and therefore the firewall was ON.

Why is the NIC changing from domain to public ?
After researching a few articles on the web, I've concluded the following:

After a restart of the only DC in the domain, AD services are not immediately available when the IP stack is initialized.
This results in the OS sensing that this is a public network and it sets the NIC accordingly.

Permanent resolution of this problem on this machine was to set the Network Location Awareness service to delayed start.

This allows AD services to become available and then the OS senses a domain network and sets the NIC accordingly.

| improve this answer | |
  • +1 for the delayed start advice. – Esa Jokinen Jan 28 '18 at 12:10
  • Our go-to permanent fix is to set NlaSvc as a dependency of all the other network services. This prevents the possibility of any other service being inexplicably delayed, or crashing, and causing NlaSvc to fire too early. > sc config nlasvc depend=NSI/RpcSs/TcpIp/Dhcp/Eventlog/DNS/NTDS – mike.thorn Mar 30 at 13:08
3

Another simpler way with Powershell:

Set-NetConnectionProfile -NetworkCategory Private
| improve this answer | |
  • 1
    This could set all NICs to private since no specific adapter is specified. – Overmind Oct 5 '17 at 7:41
  • Short and sweet... All network profiles are all set to Private in one short command. – jharrell Aug 8 '19 at 16:35
0

Had this issue on a VM and just had to restart the Network Location Awareness service to get it to figure out that it was connected to a Domain and start using a domain profile.

| improve this answer | |
0

What made it work on my Windows Server 2012 R2 standard servers was to enable IPV6 again.

In a move to make future troubleshooting easier for myself I disabled IPV6 left right and center and after doing that the Windows Firewall no longer showed that 'Domain' was connected.

Why on earth Windows can't determine that it's on a domain if only IPV4 is connected is beyond me.

bah

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.