Virtualization Technology News and Information
CODE: Virtual Server/PC - Launching programs remotely via WMI

Let's all put our hands together and give another shout out to Ben Armstrong as he comes through once again with another fantastic idea and code snippet to make our virtual lives, just a little bit easier.

This time, Ben helps answer, using Virtual Server or Virtual PC, how do I remotely and programmatically start a program running inside of a virtual machine?  Although the product doesn't do it natively, Ben suggests you can do it 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 & "."
    Wscript.Echo "Notepad could not be started due to error " & _
        Error & "."
End If

And in order to do this you will need to follow the same network configuration as discussed in one of his previous articles:


To read Ben's original post and thank him or leave him a comment, go here.


Published Saturday, June 03, 2006 10:48 PM by David Marshall
Filed under:
MS Virtual Server: WMI vs Scripting Object « Salt * Wet * Bytes - (Author's Link) - January 8, 2008 1:20 AM
MS Virtual Server: WMI vs Scripting Object « Salt * Wet * Bytes - (Author's Link) - August 10, 2011 11:03 PM
To post a comment, you must be a registered user. Registration is free and easy! Sign up now!
<June 2006>