How can I use a script to control a VirtualBox guest?

Posted by TheWickerman666 on Ask Ubuntu See other posts from Ask Ubuntu or by TheWickerman666
Published on 2012-10-01T07:36:27Z Indexed on 2012/10/01 9:49 UTC
Read the original article Hit count: 239

Filed under:

Refer to : Launch an application in Windows from the Ubuntu desktop

I was wondering if Takkat could elaborate on the actual execution i.e. howto in the script file.

This will be greatly helpful. Thanks in advance

my script file InternetExplorerVM.sh looks like this, execution is

/path/to/InternetExplorerVM.sh "C:\Program Files\Internet Explorer\iexplore.exe"

#!/bin/bash

# start Internet Explorer inside of a Windows7 Ultimate VM
echo "Starting 'Internet Explorer' browser inside Windows7 virtual machine"
echo ""
sleep 1
echo "Please be patient"

VBoxManage startvm b307622e-6b5e-4e47-a427-84760cf2312b

sleep 15

echo ""
echo "Now starting 'Internet Explorer'"
##VBoxManage --nologo guestcontrol b307622e-6b5e-4e47-a427-84760cf2312b execute --image "$1" --username RailroadGuest --password bnsf1234

VBoxManage --nologo guestcontrol b307622e-6b5e-4e47-a427-84760cf2312b execute --image "C:\\Program/ Files\\Internet/ Explorer\\iexplore.exe" --username RailroadGuest --password bnsf1234 --wait-exit --wait-stdout

echo ""
echo "Saving the VM's state now"
VBoxManage controlvm b307622e-6b5e-4e47-a427-84760cf2312b savestate

sleep 2

#Check VM state
echo ""
echo "Check the VM state"
VBoxManage showvminfo b307622e-6b5e-4e47-a427-84760cf2312b | grep State

exit

My apologies for any mistakes, this is my first time posting on askubuntu.Thanks a ton in advance. This has been very helpful. Need this for BNSF guests, their Mainframe emulator works exclusively on Java enabled Internet Explorer.

© Ask Ubuntu or respective owner

Related posts about virtualbox