[SOLVED] VBoxManage guestcontrol execute not working

Discussions about using Windows guests in VirtualBox.
Post Reply
lejap.j
Posts: 10
Joined: 26. Oct 2010, 22:59
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 10.10, MS Windows XP

[SOLVED] VBoxManage guestcontrol execute not working

Post by lejap.j »

I'm trying to open my Office 2007 Word on my Windows XP Professional SP2 32bit Guest from my Windows 7 Professional 32bit host via

Code: Select all

C:\Users\Jake>"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" guestcontrol execute 766afcb8-bc0d-4611-b91d-d9284209ae28 "C:\Programme\Microsoft Office\Office12\WINWORD.EXE" --username HTL-Grieskirchen --password ... --wait-for exit
The "success":

Code: Select all

Oracle VM VirtualBox Command Line Management Interface Version 3.2.10
(C) 2005-2010 Oracle Corporation
All rights reserved.

ERROR: The machine 'Office' does not have an open session
Details: code VBOX_E_INVALID_SESSION_STATE (0x80bb000b), component Machine, interface IMachine, callee IUnknown
Context: "OpenExistingSession(a->session, uuid)" at line 297 of file VBoxManageGuestCtrl.cpp
Obviously, I'm doing something wrong. Please help me.
Oh, I forgot: The user was logged on in the guest system, and yes the UUID is the right one, I've copied it from VBoxManage vms list...

Maybe it has something to do with the minus in the username?
Last edited by lejap.j on 27. Oct 2010, 20:18, edited 2 times in total.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: VBoxManage guestcontrol execute not working

Post by Perryg »

Try this with something else like c:\windows\system32\calc.exe first to see if it is really an error of opening the program.
lejap.j
Posts: 10
Joined: 26. Oct 2010, 22:59
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 10.10, MS Windows XP

Re: VBoxManage guestcontrol execute not working

Post by lejap.j »

No, running calc.exe doesn't work either... it also brings up that Office would not have an open session...

I don't know if this helps at all, but both my host and guest are german editions of Windows, as you have maybe already seen by my first call mentioned.

Code: Select all

C:\Users\Jake>"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" guestcontrol execute Office "c:\windows\system32\calc.exe" --username HTL-Grieskirchen --password htlgkr --wait-for exit
Oracle VM VirtualBox Command Line Management Interface Version 3.2.10
(C) 2005-2010 Oracle Corporation
All rights reserved.

ERROR: The machine 'Office' does not have an open session
Details: code VBOX_E_INVALID_SESSION_STATE (0x80bb000b), component Machine, interface IMachine, callee IUnknown
Context: "OpenExistingSession(a->session, uuid)" at line 297 of file VBoxManageGuestCtrl.cpp
Oh, and my VM runs in seamless mode, but I don't think that should be a problem sinde it also didn't work when I tried in windowed or fullscreen mode.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: VBoxManage guestcontrol execute not working

Post by Perryg »

Can I assume that the guest is actually running? Are the guest additions installed (in the guest)? I assume so since you are running seamless.

The error usually means that the guest is not running or that host can not see the guest in question.
What happens if you run
C:\Users\Jake>"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe showvminfo Office --details
from the same terminal that you tried to run the execute from
lejap.j
Posts: 10
Joined: 26. Oct 2010, 22:59
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 10.10, MS Windows XP

Re: VBoxManage guestcontrol execute not working

Post by lejap.j »

Yes, of course the guest is running and the latest guest additions are installed.
Then this is the output of the showvminfo command. As you can see, I have now activated all my hard disks to be shared with the guest, and they show up in the guest's workplace.

Looks like this in the guest:
Image

You said maybe the host cannot see the guest... But I assume then this command should not output anything at all, right?

Code: Select all

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" showvminfo Office --details

Code: Select all

Oracle VM VirtualBox Command Line Management Interface Version 3.2.10
(C) 2005-2010 Oracle Corporation
All rights reserved.

Name:            Office
Guest OS:        Windows XP
UUID:            766afcb8-bc0d-4611-b91d-d9284209ae28
Config file:     C:\Users\Jake\Virtual Machines\Office\Office.xml
Hardware UUID:   766afcb8-bc0d-4611-b91d-d9284209ae28
Memory size:     512MB
Page Fusion:     off
VRAM size:       32MB
HPET:            off
Number of CPUs:  1
Synthetic Cpu:   off
CPUID overrides: None
Boot menu mode:  message and menu
Boot Device (1): Floppy
Boot Device (2): DVD
Boot Device (3): HardDisk
Boot Device (4): Not Assigned
ACPI:            on
IOAPIC:          on
PAE:             on
Time offset:     0 ms
RTC:             local time
Hardw. virt.ext: on
Hardw. virt.ext exclusive: off
Nested Paging:   on
Large Pages:     off
VT-x VPID:       on
State:           powered off (since 2010-10-27T14:39:49.000000000)
Monitor count:   1
3D Acceleration: on
2D Video Acceleration: off
Teleporter Enabled: off
Teleporter Port: 0
Teleporter Address: 
Teleporter Password: 
Storage Controller Name (0):            IDE-Controller
Storage Controller Type (0):            PIIX4
Storage Controller Instance Number (0): 0
Storage Controller Max Port Count (0):  2
Storage Controller Port Count (0):      2
IDE-Controller (0, 0): C:\Users\Jake\Virtual Machines\Office\Snapshots\{be35e8ff-aaac-4524-8c98-bd751f5824e0}.vmdk (UUID: be35e8ff-aaac-4524-8c98-bd751f5824e0)
IDE-Controller (1, 1): Empty
NIC 1:           MAC: 0800270DE056, Attachment: NAT, Cable connected: on, Trace: off (file: none), Type: Am79C973, Reported speed: 0 Mbps, Boot priority: 0
NIC 1 Settings:  MTU: 0, Socket( send: 64, receive: 64), TCP Window( send:64, receive: 64)
NIC 2:           disabled
NIC 3:           disabled
NIC 4:           disabled
NIC 5:           disabled
NIC 6:           disabled
NIC 7:           disabled
NIC 8:           disabled
Pointing Device: PS/2 Mouse
Keyboard Device: PS/2 Keyboard
UART 1:          disabled
UART 2:          disabled
Audio:           enabled (Driver: DSOUND, Controller: AC97)
Clipboard Mode:  Bidirectional
VRDP:            disabled
USB:             enabled

USB Device Filters:

<none>

Shared folders:  

Name: 'D&P', Host path: 'G:\' (machine mapping), writable
Name: 'F&B', Host path: 'D:\' (machine mapping), writable
Name: 'I&I', Host path: 'I:\' (machine mapping), writable
Name: 'M&T', Host path: 'E:\' (machine mapping), writable
Name: 'S&P', Host path: 'C:\' (machine mapping), writable
Name: 'V&F', Host path: 'F:\' (machine mapping), writable
Name: 'Z&S', Host path: 'H:\' (machine mapping), writable

Guest:

Configured memory balloon size:      0 MB
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: VBoxManage guestcontrol execute not working

Post by Perryg »

From everything that you show the command should work. I know it works for me but do not see a reason why it does not work for you.
Let me think a bit and see if I can come up with another question.
lejap.j
Posts: 10
Joined: 26. Oct 2010, 22:59
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 10.10, MS Windows XP

Re: VBoxManage guestcontrol execute not working

Post by lejap.j »

Perryg wrote:From everything that you show the command should work. I know it works for me but do not see a reason why it does not work for you.
Let me think a bit and see if I can come up with another question.
OK thank you for now, then. :)
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: VBoxManage guestcontrol execute not working

Post by Perryg »

I just tested this again and even in seamless mode it works.
Here is a windowed view of an XP guest that I issued the command from the Windows 7 host.
guestcontrol.jpg
guestcontrol.jpg (155.65 KiB) Viewed 11378 times
lejap.j
Posts: 10
Joined: 26. Oct 2010, 22:59
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 10.10, MS Windows XP

Re: VBoxManage guestcontrol execute not working

Post by lejap.j »

Is it maybe of importance my guest runs off a VMDK image file?
lejap.j
Posts: 10
Joined: 26. Oct 2010, 22:59
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 10.10, MS Windows XP

Re: VBoxManage guestcontrol execute not working

Post by lejap.j »

Oh no, I'm such an idiot!

I think I've found the solution to the problem: I enabled "Run as Administrator" for Virtualbox, because I need to access the physical hard disk to be able to boot my Ubuntu from the it. Now when I try to run the guestcontrol command from my own user account, it doesn't work. I just tried to start the Office VM without having the "Run as Administrator" enabled (via VBoxManage startvm) and it told me that there was no such VM. This is where I started to take that into account too :D
So now let me try if it helps executung the command as Administrator...
lejap.j
Posts: 10
Joined: 26. Oct 2010, 22:59
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 10.10, MS Windows XP

Re: VBoxManage guestcontrol execute not working

Post by lejap.j »

Ah yeah now it works. Sorry for wasting your time and resources, Perry, that really was something I could've solved by myself if I'd been consequent enough with checking everything. Of course you couldn't reproduce it because I didn't tell you I was running it as admin...

I now will have to change the VirtualBox "Run as Administrator" checkbox because it should run as normal VM allowing me to call its Office programs without having to click accept on that Run as Administrator confirm window everytime I start Word ^.^

On the other hand, I'll have to leave my Ubuntu VM in Admin mode because accessing the physical hard disk need admin privilegies. Well, that can be solved by just setting it on one link.

What I'm still curios about is why the VBVoxManage list vms and showinfo commands worked...
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: VBoxManage guestcontrol execute not working

Post by Perryg »

That does explain it all. I never run as admin on Windows or Linux. Still I should have asked I guess.
Glad you have it running.
lejap.j
Posts: 10
Joined: 26. Oct 2010, 22:59
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 10.10, MS Windows XP

Re: VBoxManage guestcontrol execute not working

Post by lejap.j »

But wait, the dance isn't learned now, it's only been the first step... No, launching another process than calc.exe seems to confuse VBoxManage: it now complains about my username (precisely, any parameter after --username) being an invalid parameter... :shock:

Code: Select all

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" guestcontrol execute "Office" --username HTL-Grieskirchen --password *** "C:\Programme\Microsoft Office\Office12\WINWORD.EXE" --wait-for exit
or also

Code: Select all

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" guestcontrol execute Office --username HTL-Grieskirchen --password *** "C:\Programme\Microsoft Office\Office12\WINWORD.EXE" --wait-for exit

Code: Select all

Oracle VM VirtualBox Command Line Management Interface Version 3.2.10
(C) 2005-2010 Oracle Corporation
All rights reserved.

Usage:

VBoxManage guestcontrol     execute <vmname>|<uuid>
                            <path to program>
                            --username <name> --password <password>
                            [--arguments "<arguments>"]
                            [--environment "<NAME>=<VALUE> [<NAME>=<VALUE>]"]
                            [--flags <flags>] [--timeout <msec>]
                            [--verbose] [--wait-for exit,stdout,stderr||]


Syntax error: Invalid parameter 'HTL-Grieskirchen'
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: VBoxManage guestcontrol execute not working

Post by Perryg »

username and password go after the command to run
lejap.j
Posts: 10
Joined: 26. Oct 2010, 22:59
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 10.10, MS Windows XP

Re: VBoxManage guestcontrol execute not working

Post by lejap.j »

:oops: Ahrg it had me again... thanks now it's working how it should be.
Now I can write a little script to be also able to call it as standard application from the host, because all I need to do for that is parsing the path of the file to be opened and change the Drive Letter C->D and so on... should not be hard :)

So one more time, thank you Perry =)
Post Reply