In the VMware Infrastructure Client (VI Client), you will notice a Scheduled Tasks button on the main toolbar. That button looks like this:
Figure 1: Scheduled Tasks Toolbar Button
If you click on this button, by default, you will see that you can only create new scheduled tasks and you won’t have any scheduled tasks already created. VMware ESX VI Client Scheduled Tasks are a powerful feature of the VI Client, albeit a feature that doesn’t get a lot of recognition.
With the VI Client Task Scheduling feature, you can schedule the following tasks:
- Change the power state of a virtual machine
- Clone a virtual machine
- Deploy a virtual machine
- Move a virtual machine with VMotion
- Relocate a virtual machine
- Create a virtual machine
- Make a snapshot of a virtual machine
- Add a host
Here is what it looks like:
Figure 2: Selecting a Task to Schedule
Now, for some of these types of tasks that can be scheduled, I have trouble coming up with a scenario where you would want to perform that task when you weren’t around. For example, I am not sure why you would want to add a VMware ESX host system to Virtual Center when you weren’t around. On the other hand, there are many that I can see some great application for. Let’s look at those…
How Scheduled VMware VI Client Tasks can help you
Here are a few examples of how the VMware VI Client scheduled tasks feature can help you:
- Change the power state of a virtual machine – say that you wanted to create scheduled tasks that would power off a VM at night and power on that VM in the morning. Perhaps there is a security reason for doing this or perhaps it just helps to reboot the VM for the stability of the underlying applications. Either way, the VI Client Scheduled Task feature can do this for you.
- Make a Snapshot of a Virtual Machine – perhaps you run a process in a VM every night that, due to poor programming, can have unexpected results that cause you to have to restore data. With the VI Client scheduled tasks feature, you could schedule a snapshot to run automatically each night before that process ran. By doing that, you have created a VM snapshot automatically using the VI client scheduled tasks feature.
- Move a virtual machine with VMotion – using the VI Client scheduled tasks feature, you could create a task that you run daily and move a virtual machine from one host to another – amazing! Perhaps you need to reboot a VMware ESX server each night and this schedule tasks could alleviate any downtime for that server.
Those are just a few of the types of scheduled tasks that you can perform with the VI Client. Now let’s look at, step by step, how to create and test a scheduled task to take a snapshot of a VMware ESX Server Guest VM at a certain time.
How to create a scheduled tasks to take a snapshot of a VMware ESX Server guest VM
With the VI Client, creating a scheduled task to take a snapshot of an ESX Server guest VM at a certain time is easy. Simple click on the Scheduled Tasks button on the main VI Client Toolbar, then click New to create a new scheduled task (as in Figure 3).
Figure 3: Creating a new scheduled task
This will bring up the Schedule a Task window, as you see in Figure 2, above. At that point, you should choose the Make a Snapshot of a virtual machine option, and click OK.
Figure 4: Choosing the snapshot scheduled task
Next, a new window will come up where you will choose the VM guest that you want to make a snapshot of, like this:
Figure 5: Choosing which VM (Virtual Machine) to take a scheduled snapshot of
After clicking Next, you will be asked to provide a name for the snapshot (because we are scheduling to take a snapshot), enter notes about the snapshot, and provide any options related to the snapshot (as in Figure 6).
Figure 6: Naming the snapshot and providing snapshot options
After clicking Next, you will be asked to name the scheduled task, provide a description, then set the frequency for the task.
Figure 7: Naming and setting the frequency for the scheduled task
Notice how you can set the scheduled task to just run once, only after startup, hourly, daily, weekly, or monthly. There is a lot of flexibility in this that allows you to configure scheduled tasks and then not have to worry about them.
In our case, I chose to run the scheduled task just once and I set it to run in 2 minutes.
Figure 8: Final verification of scheduled task
I was given the option to verify the scheduled task one last time, then I clicked Finish.
I saw that the scheduled task was added to the list of scheduled tasks and very quickly the scheduled task started. I saw the progress down in the recent task list (see Figure 9, below).
Figure 9: Scheduled Task Started
The snapshot only took a few seconds and the task showed completed in the recent tasks list.
To verify it, I also went to the Events section of the VI client and saw that the task had compelted there as well.
Figure 10: VI Client Events showing the scheduled task completed
For one last point of verification, I went to the Snapshot Manager for the VM guest and I verified that the snapshot called “Scheduled Snapshot of VM” has indeed taken place (see below).
Figure 11: Snapshot manager for VM guest
And with that, we have demonstrated, step by step, how the scheduled task function of the VI Client can be used to create a scheduled task to take a snapshot of a VMware ESX Server Guest VM on a schedule.
In conclusion, automated task scheduled in your VMware Infrastructure can be very convenient and can save you a lot of time. In this article, I provided an overview of what task scheduling in the VMware Infrastructure client can do for you, scenarios where you would want to schedule tasks, and how to schedule tasks using the VI Client, step by step.