Windows 10: Set Network Location to Private or Public in Windows 10  

Page 3 of 11 FirstFirst 12345 ... LastLast
  1. Brink's Avatar
    Posts : 19,016
    64-bit Windows 10 Pro build 15063
       23 Mar 2016 #20

    questorfla said: View Post
    Out of all of this, i did get the job done but due to the fact that I am constantly using different laptops or pc's or reloading the OS on one due to one thing or another, is there anything in the way of a script that I could run to simply set "all" networks to PRIVATE? Just a quick One Click and be done with it? This would not be a good idea for most people but I never use anything that is not on a private network and it has become a real drag to run secpol.msc or one fix or another to get the VPN's to show being connected on a private network.
    I may have read it above, and may have actually done it since it does now say Private but next time it happens I would like to click a script and know it happened with one click. Windows has made it SO hard to find the one place to set this which half the time isn't where it should be anyway due to UAC or other. Not to sound like a gripe but it is late and I just need that one thing done and over with
    Thanks. I am grateful for all the Help I find here
    Hello questorfla,

    If the network names will always be the same, you could create a .bat file using the PowerShell command from OPTION FOUR to do so. You would then use "Run as administrator" on the .bat file when you want to run it.

    Here's an example of the command to place in the .bat file.

    PowerShell Set-NetConnectionProfile -Name "Brink-Router3" -NetworkCategory Private
      My ComputersSystem Spec

  2.    23 Mar 2016 #21

    Thanks. But I was hoping to be able to use the settings in secpol.msc but run as a batch or script. I have to do this al the time here due to the VPN setup. Every time it gets updated or put on a new system, you have maybe 2 seconds to grab the slide-out and tell it "YES Make this PC Discoverable etc..
    If you miss that one chance, or happen to click anything else before using it, almost every time it happens i have to hunt everywhere and end up changing UAC and everything else to be able to see it again.
    Since Secpol trumps the rest, I thought it might be the easiest to change unless that is not a good idea.

    Update: maybe best to be selective but it requires a powershell script i am not sure how to put together:
    this is close but not there. I am not sure how to allow the input of the variable nw

    I think maybe this works?
    the first part is to elevate the the command to run as admin


    Code:
    if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit }Get-NetConnectionProfile
    $nw = Read-Host 'Input the network to set to Private'
    Set-NetConnectionProfile -InterfaceIndex $nw -NetworkCategory Private
    pause
    If so,
    My first PowerShell Script
    Always used batch
    Last edited by questorfla; 23 Mar 2016 at 13:26.
      My ComputerSystem Spec

  3. Brink's Avatar
    Posts : 19,016
    64-bit Windows 10 Pro build 15063
       23 Mar 2016 #22

    I'm afraid that I don't how to do this in PowerShell to be able to help with it, but it'll be worth a try to see if it'll work.
      My ComputersSystem Spec

  4.    23 Mar 2016 #23

    Oh, it works alright, much to my amazement!
    Just tested on several users. Now I need a nice interface instead of the normal "blue screen of death look" that PowerShell runs in.
    When run, it first asks the user for permission to edit the files as this is normally prevented by the security policies.
    If they say Y(yes) it displays the status of all network connections.
    WiFi, Wired, VPN etc. From this you pick the reference# for the one that is currently public that you want to be private
    type in the number of the Network Interface (6 or 10 etc) that you want to be Private and Viola'!
    Anything not desired to be changed is not.
    For me, at least, it is a perfect solution for a time consuming and annoying task.

    Now if only I could figure out how to get the PHP code in a web-hosted document indexer to open the pdf's server-side instead of downloading them by default each time one is clicked... I am WAY! off the reservation on that one. No idea at all.
      My ComputerSystem Spec

  5. Brink's Avatar
    Posts : 19,016
    64-bit Windows 10 Pro build 15063
       23 Mar 2016 #24

    If you like, create a new thread in the Network and Sharing to see if someone may be able to further help with the script.
      My ComputersSystem Spec

  6.    10 Apr 2016 #25

    I have one like this that started out Public.
    I had to use the PowerShell approach to change it to Private.
    HOWEVER:
    The dialogs like these:


    are MISSING ENTIRELY.

    Yet, in Control Panel \ Network and Sharing Center \ Advanced Sharing settings:
    Private (Current profile)
    Turn on network discovery IS CHECKED.

    So, it works but the expected controls are missing.....

    Now I have to wonder why that should / could be?
      My ComputerSystem Spec

  7. Brink's Avatar
    Posts : 19,016
    64-bit Windows 10 Pro build 15063
       10 Apr 2016 #26

    Hello Fred,

    Double check to see if what's in the note box under step 7 below may be responsible.

    https://www.tenforums.com/tutorials/6...html#option1s7
      My ComputersSystem Spec

  8.    10 Apr 2016 #27

    Make This PC Discoverable is Missing Entirely


    Windows 10 / Settings / Network.... / Ethernet
    Double click on network
    Shows properties but NOT the "Make This PC Discoverable". That's missing.

    The network has been set to Private.
    Control Panel Advanced Settings shows that "Turn on network discovery" is CHECKED and it appears to be working.

    ?????
      My ComputerSystem Spec

  9. Brink's Avatar
    Posts : 19,016
    64-bit Windows 10 Pro build 15063
       10 Apr 2016 #28

    @fred3,

    Did you check to see if what I posted above was the issue?
      My ComputersSystem Spec

  10.    10 Apr 2016 #29

    Yes. The UAC is set to the Default which is supposed to show these things as I understand it. And that's where I found it.
      My ComputerSystem Spec


 
Page 3 of 11 FirstFirst 12345 ... LastLast

Related Threads
Network defaults to public in Network and Sharing
I have noticed in the last couple of builds the network defaults to public instead of private. I can see that on a tablet but not on a desktop. It is not hard to change the network to private but I wonder how the upgrade will behave on the millions...
Solved Private or Public in Network and Sharing
I just noticed in Windows defender My network is listed as public. Does it matter if my network is listed as private or public. I found how to change it if I have to. I just want to know if it matters. I don't know if this has anything to do with it...
I have noticed something I think is a little strange. If you install one of the later builds from offline, or where a Microsoft account is not involved, it appears your Local Network will be designated as "Public" even though the correct IP address...
Does anyone know how to change the network from Public to Private in build 9926? It's defaulting to Public with network discovery turned off, etc, and I'd like to change it to Private.
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 19:35.
Find Us
Twitter Facebook Google+ Ten Forums iOS App Ten Forums Android App



Windows 10 Forums