Yes this is totally possible. What you need to do is a Core install. However, if you do it this way you will need a second physical machine on the network, either Vista SP1 or Windows Server 2008, This is where you can run the Hyper-V Manager to create your VMs. (there are command line workarounds.)
Command line to create a Hyper-V VM:
Option Explicit
Dim HyperVServer
Dim VMName
Dim WMIService
Dim VSManagementService
Dim VSGlobalSettingData
Dim Result
Dim Job
Dim InParam
Dim OutParam
'Prompt for the Hyper-V Server to use
HyperVServer = InputBox("Specify the Hyper-V Server to create the virtual machine on:")
'Prompt for the new VM name
VMName = InputBox("Specify the name for the new virtual machine:")
'Get an instance of the WMI Service in the virtualization namespace.
Set WMIService = GetObject("winmgmts:" & HyperVServer & "rootvirtualization")
'Get the VirtualSystemManagementService object
Set VSManagementService = WMIService.ExecQuery("SELECT * FROM Msvm_VirtualSystemManagementService").ItemIndex(0)
' Initialize a new global settings for the VM
Set VSGlobalSettingData = WMIService.Get("Msvm_VirtualSystemGlobalSettingData").SpawnInstance_()
'Set the VM name
VSGlobalSettingData.ElementName = VMName
'Setup the input parameter list
Set InParam = VSManagementService.Methods_("DefineVirtualSystem").InParameters.SpawnInstance_()
InParam.SystemSettingData = VSGlobalSettingData.GetText_(1)
'Execute the method and store the results in OutParam
Set OutParam = VSManagementService.ExecMethod_("DefineVirtualSystem", InParam)
'Check to see if the job completed synchronously
if (OutParam.ReturnValue = 0) then
Wscript.Echo "Virtual machine created."
elseif (OutParam.ReturnValue <> 4096) then
Wscript.Echo "Failed to create virtual machine"
else
'Get the job object
set Job = WMIService.Get(OutParam.Job)
'Wait for the job to complete (3 == starting, 4 == running)
while (Job.JobState = 3) or (Job.JobState = 4)
Wscript.Echo Job.PercentComplete
WScript.Sleep(1000)
'Refresh the job object
set Job = WMIService.Get(OutParam.Job)
Wend
'Provide details if the job fails (7 == complete)
if (Job.JobState <> 7) then
Wscript.Echo "Failed to create virtual machine"
Wscript.Echo "ErrorCode:" & Job.ErrorCode
Wscript.Echo "ErrorDescription:" & Job.ErrorDescription
else
Wscript.Echo "Virtual machine created."
end If
end if
Last Wiki Answer Submitted: February 25, 2009 3:03 pm by Karl Gechlik0 pts.
If you live outside the United States, by submitting your email address you consent to having your personal data transferred to and processed in the United States.