Running an .msi

Jul 8, 2009 at 7:37 PM

I am trying to run an installer on a vm, but when I try and run it I get an exception.  It says "A program could not be run on the guest operating system."  Can you run msi's through the API or do I need to work around.

 

Drew

Coordinator
Jul 8, 2009 at 8:01 PM

The VMWare API is a CreateProcess type, not a ShellExecute. Now, in English, copy the MSI to the remote VM and run the MSI via "msiexec /i c:\your.msi". Unless you want it interactive add /qb, so msiexec /i c:\your.msi /qb

Jul 8, 2009 at 8:26 PM

One other quick question.  When you run something using RunProgramInGuest when is control ever passed back from that method.  It seems to get stuck, like if I open notepad how can I close it.  I can use DetachProgramInGuest, but then I can't wait until the program finishes executing.  So how can you get control to come back to the program when opening programs that don't close.

Coordinator
Jul 8, 2009 at 10:34 PM

Detach it in a thread and wait for the thread to finish.

Alternatively you can go back to the list of processes and check whether your program is still running, but it's a bit more cumbersome.