Set the Network Location

How to Assign Active Network Location with PowerShell.





Step 1:  Identify networks and associated NICs.

Get-NetConnectionProfile

Name             : domain.com

InterfaceAlias   : Ethernet (Domain)

InterfaceIndex   : 1

NetworkCategory  : DomainAuthenticated

IPv4Connectivity : Internet

IPv6Connectivity : NoTraffic



Name             : Unidentified network

InterfaceAlias   : RDMA

InterfaceIndex   : 2

NetworkCategory  : Public

IPv4Connectivity : NoTraffic

IPv6Connectivity : NoTraffic

The above examples shows two NICs that belong to two different networks.

Step 2.  Change the NetworkCategory:

Set-NetConnectionProfile -InterfaceIndex 13 -NetworkCategory Private

This example changes the active network for the NIC named RDMA.  The network location changed from Public to Private.  Confirm with Get-NetConnectionProfile.

That't It!


References:

https://docs.microsoft.com/en-us/powershell/module/netconnection/get-netconnectionprofile?view=win10-ps

0 Comments:

Post a Comment

My Instagram