The answer from the developers is, there is no API to access in the guest.
But they helped me with my VBS script so the VboxControl.exe line I was running wouldn't flash a command window. They reminded me of the WindowState command in VBS's Run method that can hide the window.
So I'm all set, problem solved! The devs rock! Thanks very much!
For reference, the script being run to change a guest property is:
Code: Select all
on error resume next
Set shell = WScript.CreateObject ("WSCript.shell")
shell.run "VBoxControl.exe guestproperty set /vmcontrol/heartbeat 1",7
wscript.sleep 30000
shell.run "VBoxControl.exe guestproperty set /vmcontrol/heartbeat 1",7
This script is run via a Scheduled Task, every minute on the guest. It changes the custom Guest Property to a "1", then waits 30 seconds, and sets the property to 1 again. The ",7" after the command on the two "shell.run" lines opens the window minimized. No flashing command window, just a little glitch on the taskbar occasionally. (I have also heard it is possible to run a program completely invisibly, even if it has a window, by having the Scheduled Task run it under a different user account than the one that's lgged on, too.)
This test batch file is on the host:
Code: Select all
set /a heartbeatcount = 0
"C:\Program Files\Oracle\VirtualBox\vboxmanage" guestproperty set {vmname} /vmcontrol/heartbeat 0
:heartbeatloop
sleep 5
"C:\Program Files\Oracle\VirtualBox\vboxmanage" guestproperty get {vmname} /vmcontrol/heartbeat > heartbeat.txt
find /i /n "Value: 1" heartbeat.txt > nul
if "%Errorlevel%"=="0" goto foundheartbeat
set /a heartbeatcount += 5
if %heartbeatcount%=={SecondsToDelay} goto noheartbeat
goto heartbeatloop
:noheartbeat
echo no heartbeat
goto end
:foundheartbeat
echo heartbeat found
:end
This displays the geartbeat stat of the VM. It sets the Guest Property to 0, then waits a certain amount of time for the guest property to change to 1 again. If it does or does not switch back to 1, the script can do whatever is desired. (My batch file has more in it: if the heartbeat doesn't come, the VM is shut down / killed and restarted, and an event is recorded in the Event Viewer. If all the VM's - 4 as of now - fail to return heartbeats, the Virtualbox main system may have crashed, so the host is forceably rebooted.)