VirtualBox guestcontrol: issues controlling guest

Discussions related to using VirtualBox on Mac OS X hosts.
Post Reply
JMason
Posts: 3
Joined: 8. Sep 2011, 12:28
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: Windows XP

VirtualBox guestcontrol: issues controlling guest

Post by JMason »

Could anyone please help me with my Question at http://stackoverflow.com/questions/7067 ... rminal-app
  • I want to use VBoxManage guestcontrol to control Windows XP in a VirtualBox VM, eventually to open a URL in IE.
  • I'm using VirtualBox 4.1.0 rc73009.
  • The host machine is Mac OS X 10.6.8
  • The VM is running Windows XP
  • The VM is called "IE8"
  • I'm working against the docs at http://www.virtualbox.org/manual/ch08.h ... estcontrol
  • I've started using VBoxManage startvm IE8 --type headless
  • For now I just want to capture output from C:\WINDOWS\system32\cmd.exe on the VM and display it in /Applications/Utilities/Terminal.app on the host.
The docs don't appear to be up to date, in that following them directly returned errors. I've tried a few variations with no luck, the closest I seem to get is the below;

Code: Select all

$ VBoxManage guestcontrol "IE8" execute --image "c:\\WINDOWS\\system32\\cmd.exe" --username Guest --wait-stdout --verbose -- "/c dir C:\\"
Waiting for guest to start process ...
VBoxManage: error: Process could not be started: VERR_UNRESOLVED_ERROR.`
As the password is empty, I've applied this to XP on the VM (from http://www.virtualbox.org/manual/ch14.html)
Also, to use accounts without or with an empty password, the guest's group policy must be changed. To do so, open the group policy editor on the command line by typing gpedit.msc, open the key Computer Configuration\Windows Settings\Security Settings\Local Policies\Security Options and change the value of Accounts: Limit local account use of blank passwords to console logon only to Disabled.
JMason
Posts: 3
Joined: 8. Sep 2011, 12:28
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: Windows XP

Re: VirtualBox guestcontrol: issues controlling guest

Post by JMason »

On a Windows host you can run the below, The "Win2003Srv" is the NAME for my particular virtual.

Code: Select all

c:\PROGRA~1\Oracle\VirtualBox>VBoxmanage guestcontrol exec Win2003Srv "C:\Documents and Settings\Administrator\Local Settings\Application Data\Google\Chrome\Application\chrome.exe" --username administrator --password <password> --arguments "http://www.virtualbox.org"
On Mac when running;

Code: Select all

VBoxmanage guestcontrol exec Win2003Srv "C:\Documents and Settings\Administrator\Local Settings\Application Data\Google\Chrome\Application\chrome.exe" --username administrator --arguments "http://www.virtualbox.org"
You get

Code: Select all

VBoxManage: error: Could not find a registered machine named 'exec'
VBoxManage: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component VirtualBox, interface IVirtualBox, callee nsISupports
Context: "FindMachine(Bstr(pszNameOrId).raw(), machine.asOutParam())" at line 421 of file VBoxManageGuestCtrl.cpp
If I swap the VM name and exec like so;

Code: Select all

VBoxmanage guestcontrol Win2003Srv exec "C:\Documents and Settings\Administrator\Local Settings\Application Data\Google\Chrome\Application\chrome.exe" --username administrator --arguments "http://www.virtualbox.org"
You get

Code: Select all

VBoxManage: error: Unknown option: '--arguments'
JMason
Posts: 3
Joined: 8. Sep 2011, 12:28
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: Windows XP

Re: VirtualBox guestcontrol: issues controlling guest

Post by JMason »

The answer is;
VBoxmanage guestcontrol "<VM NAME>" exec "<SHORT PATH TO THE BROWSER>" --username "<USER NAME>" --password "<PASSWORD>" "<URL TO OPEN>".

Also, an easy way to get the full path is in cmd.exe to do cd "<NORMAL LONG PATH TO BROWSER>" then command, and the short path name will be displayed.
Post Reply