Detect VM shutdown.

Discussions related to using VirtualBox on Windows hosts.
Post Reply
Tea Bod
Posts: 1
Joined: 29. Jan 2014, 10:43

Detect VM shutdown.

Post by Tea Bod »

Hi,

I would like to run some commands when my VM shutsdown. I'm using: "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" list runningvms

When the above runs I see a list of running VM's but im not sure how to react on the output of the "list runningVMS"

I have added this into a bat file, currently it will start the VM via the"startvm" command, what I would then like it to do is hang around(!) until the VM stops then run the command?

so

***********************
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" startvm "VM"

rem @exit

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" list runningvms

at this point wait until no vms running then do XXX
***********************

any ideas greatly appreciated.
noteirak
Site Moderator
Posts: 5231
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: Detect VM shutdown.

Post by noteirak »

Tea Bod wrote:When the above runs I see a list of running VM's but im not sure how to react on the output of the "list runningVMS"
Well, the VM name & UUID will be in the list until it stopped.

If you're asking what to actually put in your batch file, this is not the right place. You should ask on a Microsoft Scripting forum.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Post Reply