I have a Linux guest running on a Windows 7 Pro host. I have the guest started automatically at system startup using a script that does a VBoxManage startvm. This starts up the guest giving the user a guest window on their desktop (they don't actually need to use the guest window, although it is useful for when a developer has to debug things).
I have installed acpid on the Linux guest, and an ACPI Shutdown works correctly when invoked manually.
I need the user to be able to do a normal Windows Shutdown on the host without having to manually close the guest VM themselves. However, when they do a system shutdown, the Windows Close action on the VM window brings up the menu "Power Off", "Shutdown" or "Save State" and requires a manual answer. This prevents the host system shutdown until answered.
How can I set it so that the VM gets given an ACPI Shutdown automatically when Windows wants to close the guest window?
Things I have tried:
1. VBoxManage setextradata "VM name" GUI/RestrictedCloseActions SaveState,PowerOff,Restore
This makes the window-closing dialog box ONLY contain the Shutdown option, but STILL DOESN'T DO IT AUTOMATICALLY! It waits for the user to click OK.
2. Creating a StopVM.bat script containing VBoxManage controlvm "VM name" acpipowerbutton, and used gpedit.msc to set this as a Logoff script for the user.
This doesn't help, because Windows insists on closing all its windows before executing the logoff scripts. So it still gets stuck at 1 above, waiting for the user to click OK.
What VirtualBox really, REALLY needs is an option settable in the manager for each VM for "GUI Close Action", offering Save State, PowerOff, Shutdown, Restore or Ask.
Can anyone suggest a way to make it do what I need? I'm using 4.2.6.
Cheers
Tony