21 June 2017

Change Hyper-V Network Category from Public to Private and from Private to DomainAuthenticated with Powershell

This is one of those things that you can do multiple ways.
In my case however the normal routine of changing the network category type from Public to Private didn't work because my machine is domain joined.

When trying to create a HomeGroup you get this on a domain joined machine:
So PowerShell saves the day once again.
First see what adapters you have and what their current category is:
Get-NetConnectionProfile

Name             : Unidentified network
InterfaceAlias   : vEthernet (Internal Virtual Switch)
InterfaceIndex   : 8
NetworkCategory  : Public
IPv4Connectivity : NoTraffic
IPv6Connectivity : NoTraffic

Then set the adapter to category private:
Set-NetConnectionProfile -InterfaceIndex 8 -NetworkCategory Private

Check the settings:
Get-NetConnectionProfile

Name             : Unidentified network
InterfaceAlias   : vEthernet (Internal Virtual Switch)
InterfaceIndex   : 8
NetworkCategory  : Private
IPv4Connectivity : NoTraffic
IPv6Connectivity : NoTraffic

And from Private to Domain:

Check the current settings:
Get-NetConnectionProfile
Name             : Network
InterfaceAlias   : vEthernet (External V-Switch)
InterfaceIndex   : 17
NetworkCategory  : Private
IPv4Connectivity : LocalNetwork
IPv6Connectivity : LocalNetwork

Set to DomainAuthenticated:
Set-NetConnectionProfile -InterfaceIndex 17 -NetworkCategory DomainAuthenticated

Then restart the Network Location Awereness Service (NLA):
Restart-Service -Name NlaSvc -Force

And check again:
Get-NetConnectionProfile

Name             : domain.lan
InterfaceAlias   : vEthernet (External V-Switch)
InterfaceIndex   : 17
NetworkCategory  : DomainAuthenticated
IPv4Connectivity : Internet
IPv6Connectivity : Internet

No comments:

Post a Comment