Modifying network binding order using PowerShell

Have you ever needed to change the network binding order on a bunch of servers? PowerShell can help. Here are two scripts that Laurits Kofoed, a Senior Consultant with Microsoft Services in Denmark shared with me which he says he’s used to set or change the network binding order on servers. The first one is a PowerShell script that calls the second script, a batch file that uses the Nvspbind tool to change the binding order. This is a good illustration of how you can combine different kinds of scripts together (and leverage your existing batch scripting knowledge) to achieve your goal. In other words, your solution doesn’t always have to be elegant, it just needs to work.

First, here’s the PowerShell script:

$NICNames = ‘NOT_IN_USE’,’vmLAN2′,’VMLAN1′,’LiveMigration’,’ClusterHyperV’,’LAN’
foreach ($NIC in $NICNames) {
$Parameter = “””$Nic”””
& .\Bind1.bat $Parameter
}

Note that the $NICNames variable above assumes that you already know the names of the NICs on the server.

Next, here’s the single-line batch file Bind1.bat that’s called by the above PowerShell script:

c:\Temp\NVSP\nvspbind.exe /++ %1 *

Laurits says that the /++ in this batch file sets the NIC on top, so he starts with the one that should be lowest and so on. In this way you end up with the correct binding order on the server. 

For additional information, here’s a blog post from John Howard, Senior Program Manager in the Hyper-V team at Microsoft, that describes the Nvspbind tool:
http://www.wservernews.com/go/1328946191531

Finally, you can download this tool from the MSDN Archive:
http://www.wservernews.com/go/1328946204484

The above tip was previously published in an issue of WServerNews, a weekly newsletter from TechGenix that focuses on the administration, management and security of the Windows Server platform in particular and cloud solutions in general. Subscribe to WServerNews today by going to http://www.wservernews.com/subscribe.htm and join almost 100,000 other IT professionals around the world who read our newsletter!

Mitch Tulloch is an eleven-time recipient of the Microsoft Most Valuable Professional (MVP) award and a widely recognized expert on Windows Server and cloud computing technologies.  Mitch is also Senior Editor of WServerNews. For more information about him see http://www.mtit.com.

 

About The Author

Leave a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top