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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×