Quantcast
Channel: VMware Communities : Popular Discussions - VIX API
Viewing all articles
Browse latest Browse all 34639

RunProgramInGuest only works if user is already logged in interactively?

$
0
0

I am at a loss on how to use the VIX api or vmrun.exe to run programs in the guest OS. I see proofs of concepts, but never have seen any signifcant, real-life, business case example of this working. I have been through every.VIX api.resource.available.

 

Here are my operations at a high level:

1. power on VM snapshot
2. Run a program. Such as notepad.exe. Ideally, I would like to run an msi package. but keeping it simple for now...
3. shutdown the VM
4. take snapshot
Now - these steps work fine if I first manually log into an already-powered-on snapshot and just start my program in step 2. Everything just works. However, if I start at step 1 and allow VIX to power on the snapshot, my RunProgramInGuest just doesn't do what it normally would had I been logged in already. Same situation occurs for RunScriptInGuest. It seems that unless I am also already logged into the machine with a real, interactive user session, I cannot get the program to run inside the guest.
vmrun -T ws runScriptInGuest -activewindow D:\VMware-VMs\test-W7x86-3\test-W7x86-3.vmx "C:\windows\system32\cmd.exe" "/c C:\users\test\desktop\StartTask.bat"

 

UAC is off on host and guest machine. my user is Administrator. The result of running this command is that I can use listProcessesInGuest and see some new processes running under this username:

pid=2984, owner=MYDOMAIN\test, cmd="C:\Windows\System32\cmd.exe"  "C:\Users\test\AppData\Local\Temp\vixScript0"

pid=2992, owner=MYDOMAIN\test, cmd=\??\C:\Windows\system32\conhost.exe "-262616372-801187394105077478520761067478199601-1762539247384719877-515260550

 

the above is the farthest I can get. runProgramInGuest doesn't even get me this far however...I wouldn't even see the process get kicked off.

 

I have accomplished this goald with virtual box in the past. I moved toward VMWare and find it a much much better product. However this API seems a little more difficult to work.

 

I also raised a similar version of this problem here: http://stackoverflow.com/questions/12335148/unable-to-use-vix-api-to-power-on-vm-install-software-with-msiexec-then-create


Viewing all articles
Browse latest Browse all 34639

Trending Articles