[vbox-dev] Access the Virtualbox API inside the guest?

Geoff Nordli geoffn at gnaa.net
Mon Feb 27 00:55:47 GMT 2012


On Sun, Feb 26, 2012 at 8:17 AM, Scott Gustafson
<scott at rngcabinetshop.com> wrote:
> I'm using "Vboxmanage guestproperty get|set" as a heartbeat indicator in my
> VMs (Windows 7-64 Prof host running VB 4.0.16 with extension pack, SBS2003 &
> 3 XP guests with 4.0.16's guest additions). The host runs a ".cmd" batch
> file every ten minutes that "guestproperty set"s a custom property to 0,
> then waits for the guest (running its own batch file) to set the property
> back to 1. If the guest does so within a certain time, the host assumes the
> guest is working properly, since the guest has to be able to run a batch
> file successfully to respond to the heartbeat request. Everything is working
> fine.
>
> But...
>
> I can't stand those flashing command windows every ten minutes. So I'm
> looking into running the "guestproperty get|set" stuff in a Visual Basic
> Script (.vbs), which will run invisibly. I found the SDK reference manual,
> and I'm hunting through it. I've hit a jam, though. The manual offers this
> code as a test to see the version of Virtualbox from a vbs file:
>
> set vb = CreateObject("VirtualBox.VirtualBox")
> Wscript.Echo "VirtualBox version " & vb.version
> On the host, this popus up a little window with the version listed. On a
> guest, I get an error: "ActiveX component can't create object:
> 'VirtualBox.VirtualBox' "
>
> I assume either there is no API to access on a guest, or it's called by
> something else. Anyone know?
>

Hi Scott.

Do you perform some sort of action, if the guest VM isn't running?

Maybe using some sort of system monitoring tool would be a better to
to monitor if the vm is active.  This also allows you to monitor the
actual services which are running on the host to make sure they are
responding properly.

have a great day!

Geoff




More information about the vbox-dev mailing list