Set Network Location to Private in Windows 8 & 10 and Windows Server 2012 & 2016
December 29th, 2013 by Charlie Russel and tagged network location, PowerShell, Server 2012 R2, Server 2016, Windows 10, Windows 8.1
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...<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.
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 »
March 16th, 2014 at 6:08 am
Thank you very much,
you helped me escape quickly from the noisy server room.
May 6th, 2014 at 2:04 pm
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!
June 9th, 2014 at 7:42 am
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?
July 10th, 2014 at 1:54 pm
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
August 7th, 2014 at 1:36 pm
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
Jens
September 9th, 2014 at 2:58 pm
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.
August 18th, 2014 at 10:53 am
Very nice and fast. Many thanks. Mark-Allen.
August 29th, 2014 at 1:43 am
Thanks a million for this post – this worked for me when the GUI method didn’t.
September 11th, 2014 at 5:17 am
Whoa, thanks so much! This is so much easier than the GUI hell. It works!
October 31st, 2014 at 7:49 am
Thanks man. You saved my day.
November 3rd, 2014 at 5:00 am
New to PowerShell and Server 2012 R2 Datacenter Core mode in home lab. This aided me greatly! Thanks so much!
December 14th, 2014 at 9:09 am
Worked great thank you!
February 1st, 2015 at 6:16 am
Hi,
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
Thanks
Chris
February 2nd, 2015 at 9:37 am
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.
May 13th, 2015 at 6:36 am
Thanks! I found your blog post to be quite helpful! Best regards.
November 3rd, 2016 at 3:47 am
like this, thanx
November 4th, 2016 at 2:07 pm
Hello,
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
November 4th, 2016 at 3:18 pm
Sorry, I don’t know of a way to do it with WMI, and I don’t do .NET except in very limited circumstances.
December 25th, 2016 at 1:00 pm
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?
December 28th, 2016 at 1:26 pm
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