Hyper-V Program Manager
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.
dim vs, newVNetName, counter, hostNics, hostNic, hostNicNumber, newVNet
'Connect to Virtual Server
Set vs = CreateObject("VirtualServer.Application")
'Get name for new virtual network
wscript.echo "Please enter the name of the new virtual network to create:"
newVNetName = wscript.StdIn.ReadLine
'Display list of network adapters on the host
wscript.echo "Available physical network adapters:"
hostNics = vs.HostInfo.NetworkAdapters
counter = 0
for each hostNic in hostNics
wscript.echo cstr(counter) + ": " + hostNic
counter = counter + 1
wscript.echo cstr(counter) + ": No host connection"
'Get a physical network adapter
wscript.echo "Please enter the number for the physical network adapter to use:"
hostNicNumber = wscript.StdIn.ReadLine
'Check for valid input
if (cint(hostNicNumber) < 0) or (cint(hostNicNumber) > counter) then
wscript.echo "Invalid number specified"
'Create new virtual network in default location
set newVNet = vs.CreateVirtualNetwork(newVNetName, vs.DefaultVNConfigurationPath)
'Connect new virtual network if appropriate
if cint(hostNicNumber) < counter then
newVNet.HostAdapter = hostNics(hostNicNumber)
wscript.echo "A new virtual network has been created"
A couple of interesting things to notice about this script:
I must say that I have been having incredible challenges (without success) in getting Virtual PC networking to function.
I have tried comments you have recommended to others but without any luck.
In the XP SP 2 environment I would think that VPC 2007 would work fine but nothing appears to enable the guest access to the network.
Why is this so difficult and what can you recommend to address this?
Of the virtual solution for x86 with which I am working, this is by far the most difficult to get working, yet I would think that Microsoft with Microsoft would be the easiest.
Thanks in advance for the comments.
Really your job is excellent!
I have one problem, because I would like to switch the "Network" on one of my "Network Adapters", change the "Network" for other one using a script (PS or VBS).
Do you know how I can do it?