Use Powershell to change a spercific network from private

Timez

New Member
Messages
2
Hi,

Running windows 8 enterprise x64.

I am using the following powershell script I got from the internet to change ALL networks to 'private'

I wish to then change one specific network to 'public' - leaving the other ones as 'private'

Is there a command I can add on the end to change a specific network to 'public' (its the WIFI adapter).

The script im using so far does work - and changes all networks to 'private'

It has to be with powershell (so I can automate it).



SCRIPT START
--------------------------------------

# Skip network location setting for pre-Vista operating systems
if([environment]::OSVersion.version.Major -lt 6) { return }
# Skip network location setting if local machine is joined to a domain.
if(1,3,4,5 -contains (Get-WmiObject win32_computersystem).DomainRole) { return }

# Get network connections
$networkListManager = [Activator]::CreateInstance([Type]::GetTypeFromCLSID([Guid]"{DCB00C01-570F-4A9B-8D69-199FDBA5723B}"))
$connections = $networkListManager.GetNetworkConnections()

# Set network location to Private for all networks
$connections | % {$_.GetNetwork().SetCategory(1)}

--------------------------------------
SCRIPT END


Thank you in advance.

Timez
 

My Computer

System One

  • OS
    Windows 8 Enterprise (x64)
Back
Top