Set Network Location to Private in Windows 8 & 10 and Windows Server 2012 & 2016

December 29th, 2013 by and tagged , , , , ,

One of those annoyances that sometimes happen with the new Network Location in Windows 8.x and Windows 10 is that the network gets mis-identified as Public when it should be Private, or the other way around. Changing this in the GUI is certainly possible, but annoying, so let’s take advantage of the improved Windows PowerShell support in Windows 8.1 (and later) and do it quickly and easily. First, let’s open up an elevated PowerShell window from our limited user session:

PSH> Start-Process WindowsPowerShell.exe -verb RunAs

Now, in that window, let’s find out what our current network location is set to:

PSH> Get-NetConnectionProfile
Name : Unidentified network
InterfaceAlias : vEthernet (Local-10)
InterfaceIndex : 18
NetworkCategory : Public
IPv4Connectivity : LocalNetwork
IPv6Connectivity : LocalNetwork

From this, we see that the problem interface has an Interface Index of 18, so:

PSH> Set-NetConnectionProfile  -InterfaceIndex 18 -NetworkCategory Private

And we’re done.

ETA, 3 August, 2016 — this same problem exists in Windows 10/Server 2016. And the solution is the same. Set-NetConnectionProfile is your friend!

Posted in Network Administration, PowerShell, Windows 10, Windows Server 2016 | 20 Comments »

20 Responses to “Set Network Location to Private in Windows 8 & 10 and Windows Server 2012 & 2016”

  1.   Harry Says:

    Thank you very much,
    you helped me escape quickly from the noisy server room.

  2.   Bas Says:

    Thanks, worked even when local group policy computer configuration would not do the trick. Despite the network access policy set to Private it remained at Public. Probably because the computer had been part of an Active Directory domain, but was removed from it uncleanly. Powershell to the rescue!

  3.   Moe Says:

    Thanks, seems to work on a temporary basis in Windows Server 2012 R2 until a reboot. This is a DHCP server with a static IP on that card. How can I set it permanently in this scenario?

  4.   Feanor Says:

    Thanks for posting this. It worked like a charm for me and was persistent after a reboot. While I’m learning to embrace PowerShell I still like doing things in a GUI when possible. To that ends here’s a link to GUI approach for those interested.

  5.   Jens Glathe Says:

    Hi Charlie,

    thank you, thank you, thank you. Now for that “annoying” part: What is needed to put some clue into those who package the GUI? “Annoying” does not begin to describe the inner rage I feel when I see this daftness of a user interface. “Annoying” sounds more like “a mere inconvenience”, and this is a few orders of magnitude off. I see you’re an MVP. So you’re on the MSFT campus, at least sometimes. Is there anybody to talk sense to?

    with best regards


    •   Charlie Russel Says:

      Overall, I’m quite sure they’ve heard the issues with the new 8.x interface loud and clear. 8.1 was far better than 8.0 for those of us who use a command line. And the updates that have come out since 8.1 have taken it a step further. I expect the next version to address the concerns of the power user. Meanwhile, PowerShell just keeps getting better and better, so use it and love it.

  6.   Mark-Allen Says:

    Very nice and fast. Many thanks. Mark-Allen.

  7.   Chris Says:

    Thanks a million for this post – this worked for me when the GUI method didn’t.

  8.   Michael Yoo Says:

    Whoa, thanks so much! This is so much easier than the GUI hell. It works!

  9.   manzoor Says:

    Thanks man. You saved my day.

  10.   Charles Steiger Says:

    New to PowerShell and Server 2012 R2 Datacenter Core mode in home lab. This aided me greatly! Thanks so much!

  11.   Gregg Says:

    Worked great thank you!

  12.   Chris Says:

    Is there a way to force the network profile to be Domain profile?

    I have found different profiles are selected at random even though the machines are all Domain connected.
    Same machines, same network, build etc. mostly sitting there showing ‘identifying’.
    Windows 8.1 embedded x64


    •   Charlie Russel Says:

      No, you can’t force to Domain Profile. The reason is simple – Domain Profile means the machine has actually been authenticated to the domain. But if you set your Private Profile up appropriately, this shouldn’t be an issue.

      Sitting there showing “identifying” almost always means a network connectivity problem.

  13.   Sam Sanders Says:

    Thanks! I found your blog post to be quite helpful! Best regards.

  14.   Martin Says:

    like this, thanx

  15.   Volodymyr Says:


    is it possible to change network profile to Private via WMI.
    Cause I need to connect to remote PC but WMI or .NET only.

    Thank you in advance

    •   Charlie Russel Says:

      Sorry, I don’t know of a way to do it with WMI, and I don’t do .NET except in very limited circumstances.

  16.   worklife Says:

    Hi! Do you know if they make any plugins to protect against hackers?
    I’m kinda paranoid about losing everything I’ve worked hard on. Any tips?

    •   Charlie Russel Says:

      Your best defence against losing everything you’ve worked hard on is a good backup stored in a safe place. Personally, I keep mine in Azure. :)

      For a list of plugins to PowerShell, go to the PowerShell Gallery