The following small PowerShell script can do the same (it also requires administrator privileges).
It will list all non-private profiles and ask for confirmation to change them to private.
## Change NetWorkConnection Category to Private
#Requires -RunasAdministrator
Get-NetConnectionProfile |
Where{ $_.NetWorkCategory -ne 'Private'} |
ForEach {
$_
$_|Set-NetConnectionProfile -NetWorkCategory Private -Confirm
}
Sample output on my German locale system:
Name : Netzwerk
InterfaceAlias : Ethernet
InterfaceIndex : 3
NetworkCategory : Public
IPv4Connectivity : Internet
IPv6Connectivity : Internet
Bestätigung
Möchten Sie diese Aktion wirklich ausführen?
[J] Ja [A] Ja, alle [N] Nein [K] Nein, keine [H] Anhalten [?] Hilfe (Standard ist "J"): K
Edit This is the English confirmation text:
Confirm
Are you sure you want to perform this action?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): n
Always glad to help! – Run5k – 2016-12-26T20:19:56.247
14Next time I hear how MS-Windows is so pointy and clicky, with so many helpful buttons and wizards, eager to help you in any way; and how much of a dinosaur are all those obsolete command and shell-based operating systems, like Linux, are -- and how even the simplest things require arcane knowledge of shell scripting and magic incantations, I'm going to refer to this bookmarked question... – Sam Varshavchik – 2016-12-27T04:10:23.193
4
@SamVarshavchik Eh... the "Make this PC discoverable" option exists. It's not like either OS really forces you to use a GUI or various CLI(-like) methods; both are options.
– Bob – 2016-12-27T07:58:45.5872Hacking the registry since 1992... – jpmc26 – 2016-12-27T09:24:14.820
3@SamVarshavchik Wasn't this configurable from the GUI in W7? – Shaamaan – 2016-12-27T13:22:06.477
@Bob , that is a good point about the "Make this PC discoverable" option. However, many of the people that I know are utilizing a Hyper-V virtual switch and/or have their
UAC
set to Always notify. As a result, that seems to add unnecessary layers of complexity to that option. That's why I usually teach theRegistry Editor
method... it stands on its own merits. – Run5k – 2016-12-27T13:42:58.6002This answer should show the GUI version as well. Running regedit seems unusually complicated. – Jim B – 2016-12-27T13:55:27.233
1@SamVarshavchik Who says that? Ubuntu is essentially just MacOS minus some peculiar software. I certainly don't see anybody saying MacOS is non user-friendly. – xji – 2017-01-08T15:26:39.443
Please read [How to reference material written by others](https://superuser.com/help/referencing" class="soup-https-fixed). You should block quote text that has been written by some else. See Markdown help. I've fixed it for you this time, but please pay attention to this in future.
– DavidPostill – 2017-01-22T14:53:16.617@DavidPostill , absolutely… I am always ready & willing to cite my original source. Occasionally, I make judgment calls if I feel that I paraphrased and customized the source narrative to the point that it should be a simple hyperlink reference, rather than a block quote. This was one of those scenarios, and my apologies if the consensus feels that I should have gone the other way. – Run5k – 2017-01-22T15:10:29.577
I found the right profile, the only public one that had a creation date smaller than the date of last use. After restarting it becomes a private network but, Windows will soon go back to treating it as public one (eg "enable print and file sharing on all public networks?") – John – 2018-07-30T13:51:53.620