Virtualization Technology News and Information
Article
RSS
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 & "."
Else
    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: http://blogs.msdn.com/virtual_pc_guy/archive/2006/03/02/541124.aspx

 

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:
Comments
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!
top25
Calendar
<June 2006>
SuMoTuWeThFrSa
28293031123
45678910
11121314151617
18192021222324
2526272829301
2345678