Jump to content
DarrenWhite99

Set the Connected Network interface as Private (Instead of Public)

Recommended Posts

Hate it when you setup a new machine, then as soon as it is onsite it decides the new network is "Public" and stops responding on any ports? We decided that when we are setting up a new machine, wherever it is currently connected IS a Trusted network. (Specifically one our of our management servers, but the same applies with client workstations) A quick refresh of the command once the server is deployed (as part of a standard script) keeps things moving nicely. If a machine is domain joined and is on the domain network, the command will just return without any changes.

 

LOG:  Set connected network to Trusted (Private).
SHELL:  PowerShell -Command "& {if(1,3,4,5 -contains (Get-WmiObject win32_computersystem).DomainRole) { return }; $nlm = [Activator]::CreateInstance([Type]::GetTypeFromCLSID('DCB00C01-570F-4A9B-8D69-199FDBA5723B')); $net = $nlm.GetNetworks(1) | select; $net.SetCategory(1)}" and store the result in %shellresult%

Share this post


Link to post
Share on other sites
On 2/24/2019 at 9:40 PM, Tim@CCS said:

 


Get-NetConnectionProfile | Set-NetConnectionProfile -NetworkCategory Private

 

It's not a major thing now, but Windows 7/2008R2 does not support those cmdlets.

Share this post


Link to post
Share on other sites
On 5/6/2019 at 11:53 PM, DarrenWhite99 said:

It's not a major thing now, but Windows 7/2008R2 does not support those cmdlets.

Install an updated Windows Management Framework to get the latest Powershell version on older versions of Windows. WMF 5 should get you Powershell 5.0.

Share this post


Link to post
Share on other sites

You can setup a monitor and if not eq as private restart service "Network Location Awareness"

Share this post


Link to post
Share on other sites
9 hours ago, einar said:

You can setup a monitor and if not eq as private restart service "Network Location Awareness"

That's fine when the location supposed to be trusted but is not being detected correctly.  The original command was specifically for when a machine was introduced to a new location (which it would not trust) and we wanted to define this as "trusted".  A common situation is for BDR/Appliance servers that are dropped onsite.  We would image them inhouse but not complete any onboarding steps in Automate.  Once delivered and connected we assigned the agent to the correct client/location and ran an onboarding script that included setting the current (client) network as trusted.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...