Reboot Virtual Machine every 20 minutes

We need to be able to create a way to reboot virtual machines in the lab every 20 minutes automatically.

Is there any way this can be done in vSphere 5?


Solution 1:

I don't have access to vSphere now but it should be like this:

  1. Go to scheduled task (Home->...)
  2. Create new task changing VM power state
  3. Select virtual machine
  4. Select power operation option "Reset"
  5. Select Frequently
  6. Finish

Alternatively You can use vSphere CLI :

http://pubs.vmware.com/vsphere-50/topic/com.vmware.vcli.examples.doc_50/cli_manage_vms.10.6.html

Solution 2:

I would use a vSphere scheduled task for this, like Alan said.

  • "Power on": turns on the power
  • "Power off": turn off the power
  • "Shut down": tidy shutdown of the guest OS
  • "Suspend": tidy suspend of the guest OS
  • "Reset": power-cycle the guest (basically power-off then power-on)

In addition, I don't see any point in rebooting a broken machine, so you could also use non-persistent disks on it, so that when the VM reboots, it reverts back to a known good state. Otherwise rebooting a hacked machine just results in a hacked machine...

There is an obvious problem with a scheduled restart though: what happens if I connect to start testing my exploit at 13:59, and the restart is scheduled for 14:00?