2

I would like to change the connection type for "Unidentified" networks to Private in Windows using Powershell. Ideally this should work in Win 8 and 10.

An alternative solution would be to make windows identify this network and then I can set the location to private. It is a VirtualBox host only network with a Linux host.

I can use the UI to do this with the following steps:

  • Open Group policy editor eg (start -> gpedit.msc)
  • Computer Configuration -> Windows Settings -> Security Settings -> Network List Manager Policies
  • Where it says "Unidentified Networks", Right click -> Properties
  • Change "Location type" to Private

I have googled and tried:

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

$connections |foreach {
    $_.GetNetwork().SetCategory(1)
}

but this does not survive a reboot.

1 Answer 1

1

I wrote a script last year and put it on GitHub. It does exactly what you want:

Set-NetworkProfileCategory.ps1 -Name 'Unidentified network' -private

I haven't tested it for a while, but you can try.

1
  • Thanks very much. I had a quick look and it didn't work out of the box for the unidentified network. I can't remember what the error was. Next week when I'm back I'll try and track down the issue. I got as far as the 'unidentified network' wasn't in that registry path yet it was shown by the powershell command. Aug 16, 2016 at 9:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.