How to Change Network Types using PowerShell in Windows 10?

How Do I Change my network from public to private Windows 10 and Server

This is how to change network types using PowerShell commands in Windows operating systems. In Windows operating system, you find the classifies network connection with three different types which is 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 the 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.

Change Network Types using PowerShell

This is great to use a command-line interface such as PowerShell to administer and manage Windows task. As a simple user, you don’t need to use the command line but for a business network, an IT expert always needs to use these commands.

In order to change network types using PowerShell in Windows 10 or other Windows, you need to run Windows PowerShell as administrator and type the following command to detect the network types and then change it based on what you need.

Get-NetConnectionProfile

The Get-NetConnectionProfile cmdlet gets a connection profile associated with one or more physical network adapters. A connection profile represents a network connection.

Change Network Types using PowerShell
PS C:\Windows\system32> Get-NetConnectionProfile

Name             : Network
InterfaceAlias   : Ethernet0
InterfaceIndex   : 5
NetworkCategory  : Public
IPv4Connectivity : Internet
IPv6Connectivity : NoTraffic

This command shows all the specific details about the current network type. The network type has been set on the public type. let’s change it to private or domain. Specifies an array of category types of a network. The acceptable values for this parameter are

Public
Private
DomainAuthenticated

For changing the network type, you can use the following Powershell command.

Set-NetConnectionProfile

The Set-NetConnectionProfile cmdlet changes the network category setting of a connection profile. A connection profile represents a network connection.

To change a public network to a private type, just type the following command and press enter.

How to Change Network Types with PowerShell
PS C:\Windows\system32> Set-NetConnectionProfile -InterfaceIndex 5 -NetworkCategory Private

That must work perfectly.

The next step just checks the status of the network type with Get-NetConnectionProfile command.

Change Private to Public Network In Windows 10
PS C:\Windows\system32> Get-NetConnectionProfile

Name             : Network
InterfaceAlias   : Ethernet0
InterfaceIndex   : 5
NetworkCategory  : Private
IPv4Connectivity : Internet
IPv6Connectivity : NoTraffic

That’s all. The network connection profile type has changed successfully.

You can do this at once with a single command using the pipeline as a command separator.

Get-NetConnectionProfile -InterfaceIndex 5 | Set-NetConnectionProfile -NetworkCategory Private

The first part of this command gets the connection profile for the network adapter interface index id of 5. The command passes the results to the Set-NetConnectionProfile cmdlet by using the pipe operator. The second part of the command changes the value of the network category for the connection profile.

Windows Network Connections are Stuck in Public mode

You may be unable to change or set your network connection location when attempting to connect to a network using a Windows 7-based computer. The location associated with the network connection may not be a clickable link.

Cause-Related: This issue can occur if you have at inadvertently selected the checkbox beside the option to Treat all future networks that I connect to as public, and don’t ask me again. Once this option is set, you may be unable to change this setting.

How to Fix it? 

To resolve this issue follow the steps listed below:

  1. Close or suspend any applications that use the network.
  2. Click Start, type device manager in the Search programs and files box, and then press Enter.
  3. Browse the list of devices and click to expand Network adapters
  4. Right-click on the first adapter under Network Adapters and click Disable. (Repeat this step for all network adapters on your system under Network Adapters).Note After each change, Device Manager will rescan your hardware. Your monitor may blink when refreshed, this is expected.
  5. While still in Device Manager, re-enable only the adapter that’s associated with the public-network setting that you are trying to change.
    (Example, if you’re trying to connect to your wireless network, enable the wireless adapter.)Note Your system will notice your network reappearing and try to connect. This connection attempt may fail, but that’s ok, this is expected.
  6. Click Start, and type Network and Sharing Center in the Search programs and files box, and then click Network and Sharing Center, from the list
  7. In the lower-left side of the dialogue box, click Choose homegroup and sharing options.
  8. Click What is a network location? and select your network location. Note If you want to continue setting up a homegroup, follow the remaining prompts. But a homegroup isn’t required, so you also can simply exit the homegroup set up after you select the correct network location.
  9. The last step is to re-enable your remaining adapters, one by one in Device Manager. To do this simply Right-click each of the disabled adapters under Network Adapters and click Enable.
  10. When all Network Adapters are enabled, close the Device Manager and you’re done.

That is all you need to do to change network types using PowerShell. Good luck, and share us the technical issue via the comment section.


Related Queries:

Powershell change network type windows 7
Change network from public to private windows 7 command line
Change network from public to domain server 2012
Change from public to domain network windows 10
Change VPN from public to private windows 10
How to change public network to private network in windows 10
Get-netconnectionprofile windows 7
Windows server 2016 change network type to domain

Comments (0)
Add Comment