How to force a network type in Windows using PowerShell

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:

Get-NetConnectionProfile

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

Set-NetConnectionProfile -InterfaceIndex <index number> -NetworkCategory Private

For example:

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

 

TAGS: Windows 8
Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish