How to Force a Network Type in Windows Using PowerShell

Change the network profile type using PowerShell.

John Savill

June 24, 2015

1 Min Read
How to Force a Network Type in Windows Using PowerShell

For more technical explainers on PowerShell, read our updated 2021 report: PowerShell 101: A Technical Explainer for IT Pros.

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:

Get-NetConnectionProfile

Find the InterfaceIndex number of the adapter you wish to change then use command:

Set-NetConnectionProfile -InterfaceIndex  -NetworkCategory Private

For example:

PS C:> Get-NetConnectionProfileName : savilltech.netInterfaceAlias : InternalInterfaceIndex : 12NetworkCategory : DomainAuthenticatedIPv4Connectivity : LocalNetworkIPv6Connectivity : LocalNetworkName : NetworkInterfaceAlias : InternetInterfaceIndex : 13NetworkCategory : PublicIPv4Connectivity : LocalNetworkIPv6Connectivity : LocalNetworkPS C:> Set-NetConnectionProfile -InterfaceIndex 13 -NetworkCategory Private

 

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like