How to Force a Network Type in Windows Using PowerShell
Q. How can I force the type of network in Windows?
A. Windows classifies networks into three different types; public, private and domain. This allows different firewall configurations to be applied based on the type of network, for example the most restrictive configuration for public and the least restrictive for domain networks. By default any new network connection is made a public connection and if Active Directory services are found on the network its type is automatically changed to domain. If you need to force a network to be of a different profile, most commonly to change a public network to a private network the easiest way is to use PowerShell.
Let’s first get a look at the profile used by your network adapters:
Find the InterfaceIndex number of the adapter you wish to change then use command:
Set-NetConnectionProfile -InterfaceIndex <index number> -NetworkCategory Private
PS C:\> Get-NetConnectionProfile Name : savilltech.net InterfaceAlias : Internal InterfaceIndex : 12 NetworkCategory : DomainAuthenticated IPv4Connectivity : LocalNetwork IPv6Connectivity : LocalNetwork Name : Network InterfaceAlias : Internet InterfaceIndex : 13 NetworkCategory : Public IPv4Connectivity : LocalNetwork IPv6Connectivity : LocalNetwork PS C:\> Set-NetConnectionProfile -InterfaceIndex 13 -NetworkCategory Private