Changing network interface priority on Windows (interface metric)
View and change the interface metric with PowerShell to control which network interface Windows prefers.
On a Windows machine with several network interfaces, the interface metric influences which route is used: for the same destination, Windows prefers the route with the lowest total metric. This page shows how to view and change the metric with PowerShell.
Viewing the interfaces
Get-NetIPInterface
Note the InterfaceIndex of the interface to change, together with its InterfaceMetric and AutomaticMetric values.
Setting a manual metric
Set-NetIPInterface -InterfaceIndex 21 -InterfaceMetric 10
Replace 21 with the index found in the previous step. A lower value makes the interface more preferred.
Going back to automatic metric
Set-NetIPInterface -InterfaceIndex 21 -AutomaticMetric enabled
Notes
- These commands change the interface metric, not the adapter binding order shown in the network connections settings.
- The commands require administrator rights.