Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
261 views
in Technique[技术] by (71.8m points)

windows - Executing an application with Vboxmanage guestcontrol does not display on guest

I want to use VirtualBox vboxmanage to launch an application on many Guest machine to perform tests.

In my case I have a Windows host and Windows guest machines.

Using vboxmanage does spawn the application process (in fact you can see it on Task Manager) but does not show the application on the Guest screen.

Seems like my application does not have a screen to display or does have a different one...

Is possible to display the application using vboxmanage? What am I missing?

Thanks

Example of a performed command:

"C:Program FilesOracleVirtualboxVBoxManage.exe" guestcontrol "Win64" --password pw --username admin run --exe c:windowssystem32cmd.exe --putenv JAVA_PATH=c:estsjre -- cmd.exe/arg0 /C C:estsjreinjava.exe -jar c:estssikulix -r c:estsest_app.sikuli
question from:https://stackoverflow.com/questions/65832231/executing-an-application-with-vboxmanage-guestcontrol-does-not-display-on-guest

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I managed to launch an application on Windows guest and to have the application show on the screen, so I will post here how to do if anyone needs something similar.

After putting in place the virtual machine with only host network in order to be able to connect from Host to Guest, I used psexec to interact with guest as the follows:

psexec.exe \ipaddress -i 1 -u WORKGROUPusername -p password c:pathomyapplication.exe -d

Some notes about the command:

  • -i 1 is the options that allows to interact with the desktop of the specified session
  • -d could be used in order not to wait the process to terminate
  • WORKGROUPusername pay attention to specify the workgroup

In order to automate operation on multiple virtual machines you can determine the ip address parsing the result of this command:

"C:Program FilesOracleVirtualboxVBoxManage.exe" guestproperty enumerate vmname

or you can parse the result of a systeminfo on guest like the following:

"C:Program FilesOracleVirtualboxVBoxManage.exe" guestcontrol MyVMname run --username myusername --password my-password --wait-stdout --wait-stderr --exe "C:WindowsSystem32cmd.exe" -- cmd.exe/arg0 /C systeminfo

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...