Power Off The Machine

Discussions related to using VirtualBox on Windows hosts.
Post Reply
VirtualBox_2019
Posts: 24
Joined: 20. Apr 2019, 22:10

Power Off The Machine

Post by VirtualBox_2019 »

Before Version 7.0, there is a checkbox to auto restore a snapshot when "Power Off The Machine". Has this feature been removed in Version 7.0?

https://www.geekrar.com/wp-content/uplo ... re-min.jpg
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Power Off The Machine

Post by scottgus1 »

Yes, it has been. There were apparently enough users (Oracle's paying customers?) that were using that checkmark wrong and were losing their data that the devs took out the checkbox.

The last snapshot can still be restored through the VM's snapshots page in the main Virtualbox window.
VirtualBox_2019
Posts: 24
Joined: 20. Apr 2019, 22:10

Re: Power Off The Machine

Post by VirtualBox_2019 »

Thank You Scott for your confirmation on this.

I wonder if there is a command line to put the checkbox back in? Otherwise, the other option is, I can write a batch file to restore the snapshot rather than navigating on the VM interface with a few more clicks.

The other thing I don't like about version 7 is the progress bar on the right side of the VM. I have been using Virtualbox for almost 10 years and everything has been so good up until these two features. :mrgreen:
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Power Off The Machine

Post by scottgus1 »

VirtualBox_2019 wrote:I wonder if there is a command line to put the checkbox back in?
Unfortunately, no. There was a big discussion in the beta period about this, but the devs have remained firm in not putting it back in. Probably the bosses drew the line.
VirtualBox_2019 wrote: can write a batch file to restore the snapshot
This may be a good workaround. Please post what you come up with.
VirtualBox_2019
Posts: 24
Joined: 20. Apr 2019, 22:10

Re: Power Off The Machine

Post by VirtualBox_2019 »

Hi Scott, here is the basic command line code that you can restore a snapshot by clicking on a batch file. Make sure the batch file is encoded as ANSI, not Unicode. Otherwise, it will not run. This goes for all batch files and I am sharing this because NotePad++, etc... sometimes default to Unicode. Took me over weeks to try to understand why it worked on CMD but not in the batch file.

Code: Select all

CD "C:\Program Files\Oracle\VirtualBox\"
VBoxManage.exe snapshot <Name_of_VM> restore <Name_of_Snapshot>
VirtualBox_2019
Posts: 24
Joined: 20. Apr 2019, 22:10

Re: Power Off The Machine

Post by VirtualBox_2019 »

Basically, I add the batch file to my taskbar and it can restart the instance too with one of these:

Code: Select all

VBoxManage.exe list vms
VBoxManage.exe list runningvms

VBoxManage.exe startvm "Your VM"

VBoxManage.exe controlvm "Your VM" acpipowerbutton
VBoxManage.exe controlvm "Your VM" poweroff
VBoxManage.exe controlvm "Your VM" reset
fth0
Volunteer
Posts: 5678
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Power Off The Machine

Post by fth0 »

VirtualBox_2019 wrote:I wonder if there is a command line to put the checkbox back in?
For an explanation and an alternative to the checkbox, see the two posts of klaus in VM - Snapshot restore on power off (GUI/DiscardStateOnPowerOff).
VirtualBox_2019
Posts: 24
Joined: 20. Apr 2019, 22:10

Re: Power Off The Machine

Post by VirtualBox_2019 »

fth0

Code: Select all

VBoxManage setextradata "Test" GUI/DiscardStateOnPowerOff 1
Do I need to run this each time I power off the instance? Most likely not right? It is a one set and forget thing right? If that is the case and similar to the checkbox, that is exactly what I am looking for.

Thank You for sharing.
VirtualBox_2019
Posts: 24
Joined: 20. Apr 2019, 22:10

Re: Power Off The Machine

Post by VirtualBox_2019 »

BTW... Can I run it to turn on/off when the VM is still running?
VirtualBox_2019
Posts: 24
Joined: 20. Apr 2019, 22:10

Re: Power Off The Machine

Post by VirtualBox_2019 »

The answer is "YES" to both of my previous posts. Thanks.
Elwood
Posts: 1
Joined: 10. Dec 2023, 00:07

Re: Power Off The Machine

Post by Elwood »

The checkbox is back! Somewhere between versions 7.0.2 and 7.0.12.
Thanks to those involved.
Post Reply