Sunday, February 21, 2016

Change network connection profile by PowerShell on Windows 8 or later

Started from Windows 8, there are 2 PowerShell cmdlets for administrators to get and set network connection profiles which are Get-NetConnectionProfile and Set-NetConnectionProfile.

Get-NetConnectionProfile can check the current network connection profile for all network NICs.

The current network profile of this NIC is "Private"

To change the network connection profile to public, we can perform Set-NetConnectionProfile -InterfaceAlias <NIC Name> -NetworkCategory Public.

The network connection profile has been changed to "Public"

Make sure the PowerShell console is "run as administrator". if not, you get the following error message.

Set-NetConnectionProfile : Unable to set the NetworkCategory ...

From Windows 10 PowerShell console

The another reason to show this error message is that you performed Set-NetConnectionProfile to "DomainAuthenticated".

From Windows 8.1 PowerShell console

"DomainAuthenticated" network connection profile should be automatically assigned when a computer was joined domain. It cannot be changed by Set-NetConnectionProfile cmdlet because it is controlled by "Network List Manager" of Group Policy. However, we can change the other NICs of domain computers.

This posting is provided “AS IS” with no warranties, and confers no rights!

No comments:

Post a Comment