How to change the binding order of network adapters using commandline(wmi, netsh, vbscript, etc...)

li hl picture li hl · Oct 17, 2012 · Viewed 10.9k times · Source

I have several network connections that are connected to different networks. and I want to make sure that a certain network connection is at the top of the list. so I want to programmatically script changes to the binding order of network adapters for a windows(win 2008 server and win 2003 server)

Is it any way to change the binding order programmatically?just use wmi, netsh, vbscript, edit regstry or other script or command line tools.

I found edit registry registry HKLM\system\currentcontrolset\services\TCPIP\linkage\ -> bind value, is a way on windows 2008 server. use "netstat -rn" can found binding order is changed. but the on the networking advenced UI(ncpa.cpl) the order is not changed. and looks it not working on windows 2003 server.

Is any one have idea How to change the binding order of network adapters using commandline?

Thanks

Answer

Dss picture Dss · Feb 21, 2014

This looks to be what you are after: http://realworldwindows.blogspot.com/2006/11/changing-network-provider-order-in.html

Alternatively, you could easily script a batch file that disables the primary adapter so that the adapter you want to be primary takes over. Then re-enable the original one again.

Example:

@echo off
netsh interface set interface "Local Area Connection" DISABLED
:: do something here on the secondary connection
netsh interface set interface "Local Area Connection" ENABLED