Page 1 of 1

Detect VM shutdown.

Posted: 29. Jan 2014, 10:59
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.

Re: Detect VM shutdown.

Posted: 1. Feb 2014, 18:26
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.