Set Network Location to Private, Public, or Domain in Windows 10  

Page 3 of 12 FirstFirst 12345 ... LastLast

  1. Posts : 68,668
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #20

    questorfla said:
    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 Computers


  2. Posts : 232
    Win 10 Ver 1903
       #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 Computer


  3. Posts : 68,668
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #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 Computers


  4. Posts : 232
    Win 10 Ver 1903
       #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 Computer


  5. Posts : 68,668
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #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 Computers


  6. Posts : 42
    Windows 7, 8.1, 10
       #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 Computer


  7. Posts : 68,668
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #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 Computers


  8. Posts : 42
    Windows 7, 8.1, 10
       #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 Computer


  9. Posts : 68,668
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #28

    @fred3,

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


  10. Posts : 42
    Windows 7, 8.1, 10
       #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 Computer


 

Tutorial Categories

Set Network Location to Private, Public, or Domain in Windows 10 Tutorial Index Network & Sharing Instalation and Upgrade Browsers and Email General Tips Gaming Customization Apps and Features Virtualization BSOD System Security User Accounts Hardware and Drivers Updates and Activation Backup and Restore Performance and Maintenance Mixed Reality Phone


  Related Discussions
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 06:33.
Find Us




Windows 10 Forums