Automatic startup/shutdown of VM

Discussions related to using VirtualBox on Windows hosts.
Post Reply
soulblade64
Posts: 5
Joined: 9. Oct 2008, 03:51

Automatic startup/shutdown of VM

Post by soulblade64 »

So I have a Windows 7 host, and I want to have a VM run headless on startup, and shutdown gracefully when I shut down the PC.

I have correctly created the scripts to start and shutdown the VM, when fired manually they work like a charm. Particularly I am having issues with the shutdown script. When I try adding the script in gpedit.msc, both to the shutdown and logoff scripts section, the VM fails to gracefully shut down before the the system shuts down.

Is there anything I need to put into my script to make it work, or anything I've got to configure in the host to make it wait for the script to run and shut the VM down?
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Automatic startup/shutdown of VM

Post by Sasquatch »

Use saved state instead of a graceful shutdown, because that takes way too long. The system only waits for a few seconds, just enough for save state to work, but too short for a graceful shutdown. Also, if it's a server OS inside the VM, it won't listen to the ACPI power button command most of the time.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
soulblade64
Posts: 5
Joined: 9. Oct 2008, 03:51

Re: Automatic startup/shutdown of VM

Post by soulblade64 »

Sasquatch wrote:Use saved state instead of a graceful shutdown, because that takes way too long. The system only waits for a few seconds, just enough for save state to work, but too short for a graceful shutdown. Also, if it's a server OS inside the VM, it won't listen to the ACPI power button command most of the time.
I have considered save state, but I would prefer it to shut down. I've even tried delays in the script, but that doesn't work either.

Guest OS is Windows 7, so it the ACPI power button works.

I've also realised that VBoxHeadlessTray is easier than scripting, and if I have to use save state, this is my best bet.
bodycount2
Posts: 2
Joined: 13. May 2011, 11:48
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: WindowsXP, Ubuntu

Re: Automatic startup/shutdown of VM

Post by bodycount2 »

Hi, I also made .bat scripts for starting up and shutting down the machines. scripts run perfectly when started manually, but when I add them to local computer policy/window settings/scripts/shutdown, confirmation window for saving machine state pops up, how to get rid of confirmation window?
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Automatic startup/shutdown of VM

Post by Sasquatch »

What command are you using? It shouldn't ask when you use the proper command.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Leak
Posts: 242
Joined: 31. Mar 2009, 13:00
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Debian Testing, Windows XP, Windows Server 2003/2008 R2

Re: Automatic startup/shutdown of VM

Post by Leak »

Sasquatch wrote:What command are you using? It shouldn't ask when you use the proper command.
He posted more details here...
Post Reply