Set Network Location to Private in Windows 8.1/Server 2012 R2

One of those annoyances that sometimes happen with the new Network Location in Windows 8.x 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 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
...<snip>...
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.

4 Responses to Set Network Location to Private in Windows 8.1/Server 2012 R2

  • Harry says:

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

  • 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!

  • 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?

  • Feanor says:

    Charlie,
    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.
    http://anonit.blogspot.com/2014/02/change-network-location-in-server-2012.html

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>