Just recently a WSL member had a problem changing a Windows 10 network connection from the default Public to Private when the GUI settings to do this were missing.
Further research shows that there’s a documented method of enumerating network connections. This can be used via COM to iterate through each network connection, changing the value for ‘Category’ to 1, i.e. Private.
I’m not at all familiar with PowerShell but, using AutoHotkey, this can be accomplished by the following:
#NoEnv #NoTrayIcon SetBatchLines, -1 NetworkListManager := ComObjCreate(“{DCB00C01-570F-4A9B-8D69-199FDBA5723B}”) IEnumNetworkConnections := NetworkListManager.GetNetworks(NLM_ENUM_NETWORK_ALL := 3) for INetwork in IEnumNetworkConnections INetwork.SetCategory(1) ; NLM_NETWORK_CATEGORY_PRIVATE
This is better than changing the ‘Category’ value via the registry, not least of which is that it can be carried out ‘on-the-fly’ to a currently-connected network.
I’ve added this because it should be possible to help people in future like the OP who have a similar issue… and ‘cos I’ve just discovered the method. 🙂
Hope this helps…