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

FYI, this is the powershell we use to do this

 

Get-NetConnectionProfile | Set-NetConnectionProfile -NetworkCategory Private

 

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

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...