-- Ben Armstrong, Virtualization Program Manager
Talking about core virtualization at Microsoft (Hyper-V, Virtual PC and Virtual Server).
One thing that people regularly ask how to do with Virtual Server / Virtual PC is to be able to remotely, programmatically start a program running inside of a virtual machine. We do not provide anyway to do this directly with our products - however you can do this by using the built in support in Windows. The following script will open a copy of notepad on a remote computer:
strComputer = "NameOrIPAdressOfVirtualMachine"Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2:Win32_Process") Error = objWMIService.Create("notepad.exe", null, null, intProcessID)If Error = 0 Then Wscript.Echo "Notepad was started with a process ID of " _ & intProcessID & "."Else Wscript.Echo "Notepad could not be started due to error " & _ Error & "."End If
strComputer = "NameOrIPAdressOfVirtualMachine"Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2:Win32_Process")
Error = objWMIService.Create("notepad.exe", null, null, intProcessID)If Error = 0 Then Wscript.Echo "Notepad was started with a process ID of " _ & intProcessID & "."Else Wscript.Echo "Notepad could not be started due to error " & _ Error & "."End If
In order to do this you will need to follow the same network configuration as discussed in this article: http://blogs.msdn.com/virtual_pc_guy/archive/2006/03/02/541124.aspx
Cheers,Ben