Can I creating and connecting a Virtual Network with VBScript?

Yes, you can.  More information is in Ben’s post “creating-and-connecting-a-virtual-network-with-vbscript“:

Okay - so this week I have a little VBScript to create and connect a virtual network under Virtual Server.  This script asks for the name of the new virtual network, then asks the user to select a physical network adapter to connect the virtual network to, and finally creates and configures the virtual network.

A couple of interesting things to notice about this script:

  • When attaching a virtual network to a physical network adapter, you need to be able to provide the identification string for the network card.  This is a bit annoying, but you can get this information from vs.HostInfo.NetworkAdapters (which returns a collection of strings).  If you want you can also just use vs.HostInfo.NetworkAdapters(0) to connect to the first physical network adapter in the computer (yes, the collection is 0 indexed). 
  • You can’t specify anything when creating a virtual network, so you need to configure the virtual network after creating it.
  • When creating a new virtual network you need to specify the path for the new virtual network.  This is kind of odd - as all virtual networks are created in the same location, and there is no way for you to change this default location - but you can grab this path from vs.DefaultVNConfigurationPath

Leave a Reply

You must be logged in to post a comment.