How to start a windows and run dedicated programs then revert to original status

I wonder know if there is a way,

Can let me start up a Windows (which including my custom environment: Ruby, Ruby on Rails ready )

And execute the dedicated process,(some environment could be dirty/changed)

So after that, shut down the Windows and revert it to original status.

Next time when I can do the same thing within a clean environment.

I prefer the above job can be done in Ubuntu OS, and virtual machine (Vmware, virtualbox, ...)

Any ideas, Thanks in advance.

2 Answers 2


They invented Vagrant for this, you can defined a base image, boot the image, run scripts and install software from its configuration to make sure you and everyone else in your team always has the same machine. Bring it down, bring it back and ask for a clean machine all from the command line.

Vagrant supports both Linux and Windows guests.

It uses VirtualBox and supports Puppet or Chef scripts for easy maintenance.

You can use Vagrant to setup a new clean test environment before each test run. If the developer use the same setup with Vagrant you will never hear it works on my machine again :)


VMWare ESX/Workstation and VirtualBox both have robust CLI's provided by the integration of their respective guest plugins. These CLI's allow you to configure everything from system hardware to power status and snapshot management. You would basically have a script that passes the startup command the respective CLI, call the test, pass the shutdown command to the respective CLI, and the pass the snapshot revert command to the CLI.

The VirtualBox commands you want are snapshot, startvm, and controlvm. These commands are detailed here:


The VMWare CLI commands you want are vmware-cmd start, vmware-cmd stop, and vmware-cmd revertsnapshot. You can find their extensive documentation here:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.