92

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).

1
  • 1
    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, 2019 at 17:53

7 Answers 7

87

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://docs.microsoft.com/en-us/powershell/module/netconnection/set-netconnectionprofile?view=winserver2012r2-ps

6
  • 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").
    – vgru
    Oct 23, 2014 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 Feb 4, 2017 at 10:06
  • Thanks for a proper solution that doesn't open up RDP on any unknown network. Apr 7, 2017 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, 2018 at 11:57
  • Works great at Windows Server 2016 Standard
    – Can YILDIZ
    Nov 25, 2019 at 13:46
59

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

3
  • How do I set network as Domain Network?
    – Krunal
    Sep 27, 2018 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. Nov 2, 2018 at 6:42
  • Please note that if you set "user Permission: user CAN change location", the location type above is not applied. Set this to "cannot"
    – Sergei
    Jul 2, 2020 at 9:26
38

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.

9
  • This is basically what the accepted answer states, right?
    – vgru
    Aug 27, 2015 at 17:05
  • 7
    This command does not require a variable. One line and done. It is an improved command.
    – techman
    Aug 27, 2015 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, 2015 at 18:29
  • 1
    It does BTW not work on Windows 7, this comandlet is introduced in 2012/8.
    – eckes
    May 29, 2017 at 11:47
  • 2
    Use: get-NetConnectionProfile to check current status and names of your interfaces.
    – Tilo
    Jan 19, 2018 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.

2
  • +1 for the delayed start advice. Jan 28, 2018 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 Mar 30, 2020 at 13:08
3

Another simpler way with Powershell:

Set-NetConnectionProfile -NetworkCategory Private
2
  • 1
    This could set all NICs to private since no specific adapter is specified.
    – Overmind
    Oct 5, 2017 at 7:41
  • 2
    Short and sweet... All network profiles are all set to Private in one short command.
    – jharrell
    Aug 8, 2019 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.

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .