Monday, February 23, 2015

Working with vSphere scheduled tasks

You can create scheduled tasks for operations that you want to automatically run once or at a recurring interval.
One cannot define scheduled tasks on an ESXi alone, you have to use vCenter to create and manage scheduled tasks.
The tasks you can schedule are listed in the following table:

Scheduled Task
Description
Add a host
Adds the host to the specified datacenter or cluster.
Change the power state of a virtual machine
Powers on, powers off, suspends, or resets the state of the virtual machine.
Change cluster power settings
Enable or disable DPM for hosts in a cluster.
Changes the following resource settings:
CPU – Shares, Reservation, Limit.
Memory – Shares, Reservation, Limit.
Check compliance of a profile
Checks that a host's configuration matches the configuration specified in a host profile.
Clone a virtual machine
Makes a clone of the virtual machine and places it on the specified host or cluster.
Create a virtual machine
Creates a new virtual machine on the specified host.
Deploy a virtual machine
Creates a new virtual machine from a template on the specified host or cluster.
Migrate a virtual machine
Migrate a virtual machine to the specified host or datastore by using migration or migration with vMotion.
Make a snapshot of a virtual machine
Captures the entire state of the virtual machine at the time the snapshot is taken.
Scan for Updates
Scans templates, virtual machines, and hosts for available updates.
This task is available only when vSphere Update Manager is installed.
Remediate
Installs missing patches from the baselines selected for remediation on the hosts discovered during the scan operation and applies the newly configured settings.
This task is available only when vSphere Update Manager is installed.

To create scheduled tasks one should have Schedule Task.Create Tasks access privilege. You create scheduled tasks by using the Scheduled Task wizard. For some scheduled tasks, this wizard opens the wizard used specifically for that task. For example, if you create a scheduled task that migrates a virtual machine, the Scheduled Task wizard opens the Migrate Virtual Machine wizard, which you use to set up the migration details.
Scheduling one task to run on multiple objects is not possible. For example, you cannot create one scheduled task on a host that powers on all virtual machines on that host. You must create a separate scheduled task for each virtual machine.
How to Create a Scheduled Task:

Using vSphere client you will find the options here, Home => Management => Scheduled Tasks => The current list of scheduled tasks appears, In the toolbar, click New
And

Using vSphere Web client you will find the options here, Navigate to the object for which you want to schedule a task => Select Manage => then select Scheduled Tasks => From the Schedule New Task drop-down list, select the task to schedule.
                                                 
                                             Available options when we selected Datacenter/Cluster

                                                                   VM related available scheduled tasks

If the task to schedule is not available in the VI or Web Client, use the vSphere API.
Caution: Do not schedule multiple tasks simultaneously on the same object. The results are unpredictable.
There is a known issue of Cannot schedule tasks or set the correct time on ESXi hosts from the VMware vSphere Web Client 5.5. This issue is resolved in vCenter Server 5.5 Update 2d.

Want to read more about vSphere scheduled tasks, take a look of ESXi and vCenterServer 5.x Documentation.

That's it.... :)



No comments:

Post a Comment