So you just created a brand new VPN connection to let’s say work, and Windows decided that it is a completely untrusted network connection, setting it to a public network. Here is how you can quickly and immediately change the network type using powershell.
- Start an elevated powershell prompt
- Use the following command to list the known networks:
Get-NetConnectionProfile
- This will net you something like below. Note that the VPN in this example is named “IPSEC”, and that the type is Public, which we want to change
PS C:\Windows\system32> Get-NetConnectionProfile
Name : IPSEC
InterfaceAlias : IPSEC
InterfaceIndex : 24
NetworkCategory : Public
IPv4Connectivity : LocalNetwork
IPv6Connectivity : NoTraffic
Name : corp.nhcoding.nl
InterfaceAlias : Ethernet
InterfaceIndex : 6
NetworkCategory : DomainAuthenticated
IPv4Connectivity : Internet
IPv6Connectivity : NoTraffic
PS C:\Windows\system32>
- Next, we can issue our change comment:
Set-NetConnectionProfile -Name IPSEC -NetworkCategory Private
- Note that the change is immediate, no need to reconnect or restart anything