How can I define the network connection priority order from the command line
You can download nvspbind from Microsoft to do this.
It can be used to enable or disable specific bindings on any NIC
and to query and change the NIC connection order.
See the /+, /++, /- and /-- options.
Example:
Set the priority of the 'Wireless network connection' to the top of the binding order:
nvspbind.exe /++ "Wireless Network Connection" ms_tcpip
Hyper-V Network VSP Bind (nvspbind)
nvspbind is a tool for modifying network bindings from the command
line. It is especially useful in Server Core environments with the
Hyper-V role enabled.
It can be used to set the correct bindings for NICs used in Virtual
Networks.
It can also be used to enable or disable specific bindings on any NIC
and to query and change the NIC connection order.
It utilizes the INetCfg APIs documented on MSDN
(http://msdn.microsoft.com/en-us/library/ms805265.aspx).
Most options are documented in the readme and nvpsbind.txt which
download with the install.
To get help run nvspbind.exe /?
C:\>nvspbind /?
Hyper-V Network VSP Bind Application 6.1.7690.0.
Copyright (c) Microsoft Corporation. All rights reserved.
Usage: nvspbind option NIC protocol
Options:
/n display NIC information only
/u unbind switch protocol from specified nic(s)
/b bind switch protocol to specified nic(s)
/d disable binding of specified protocol from specified nic(s)
/e enable binding of specified protocol to specified nic(s)
/r repair bindings on specified nic(s)
/o show NIC order for specified protocol
/+ move specified NIC up in binding order for specified protocol
/- move specified NIC down in binding order for specified protocol
/++ move specified NIC up to top of binding order for specified protocol
/-- move specified NIC down to bottom of binding order for specified protocol
There are three variations:
Microsoft_Nvspbind_package.EXE is the standard 64 bit version for server core.
32bit_Nvspbind_package.EXE is a 32 bit version that works on Vista and newer.
XP_Nvspbind_package.EXE is a reduced functionality 32 bit version that works on XP and newer.
Although I work for Microsoft as a developer on the Hyper-V team, I must point out that as the license tab indicates this tool and documentation are provided "as-is". You bear the risk of using it. No express warranties, guarantees or conditions are provided. It is not supported or endorsed by Microsoft Corporation and should be used at your own risk.
Verified on the following platforms
Windows Server 2012 Yes
Windows Server 2008 R2 Yes
Windows Server 2008 Yes
Windows Server 2003 No
Windows 8 Yes
Windows 7 No
Windows Vista No
Windows XP No
Windows 2000 No
This script is tested on these platforms by the author. It is likely to work on other platforms as well.
Source nvspbind
thx for that.. sadly those tools are not official – becks21 – 2015-10-08T19:20:12.460
@becks21 They are from Microsoft (but unsupported). – DavidPostill – 2015-10-08T19:23:41.850
@becks21 You can probably write something in PowerShell or VBA that calls the same
INetCfgAPI as the MS tool uses. I did search for code but couldn't find anything ready made for your exact requirements. I don't think you can do it directly withwmic– DavidPostill – 2015-10-08T19:26:14.627