Powershell: Change binding order network interfaces

Sometimes there are some applications which take the ‘first network card’ in order to send/receive traffic.
If you have multiple network cards, this can be problematic of course.
In case you want to resolve that, you can change the order of the network cards.
In order to do that, first get the interface index id.
This can be found with the Get-NetIPInterface command in powershell:

ifIndex InterfaceAlias                  AddressFamily NlMtu(Bytes) InterfaceMetric Dhcp     ConnectionState PolicyStore ------- --------------                  ------------- ------------ --------------- ----     --------------- ----------- 26      Teredo Tunneling Pseudo-Inte... IPv6                  1280              50 Enabled  Disconnected    ActiveStore 19      isatap.{529E76FA-1803-4A9E-8... IPv6                  1280              50 Disabled Disconnected    ActiveStore 18      isatap.{AD1391A5-B98A-441B-B... IPv6                  1280              50 Disabled Disconnected    ActiveStore 1       Loopback Pseudo-Interface 1     IPv6            4294967295              50 Disabled Connected       ActiveStore 17      IP1-vlan111                     IPv4                  1500              10 Disabled Connected       ActiveStore 16      IP2-vlan118                     IPv4                  1500              10 Disabled Connected       ActiveStore 1       Loopback Pseudo-Interface 1     IPv4            4294967295              50 Disabled Connected       ActiveStore

Now you can change the order with the Set-NetIPInterface command. Of course, you need to run powershell as administrator to accomplish this.
The command below will set the card with interface id 16, IP2-vlan118, as first card.

 Set-NetIPInterface -InterfaceIndex 16 -InterfaceMetric 1
Share your love