Understanding the ScheduledTaskManager Interface

You can use the ScheduledTaskManager to schedule tasks. In the vSphere Client, scheduled tasks display in the Task & Events tab.

You can define actions to occur on vCenter Server at different times:

  • When a vCenter Server system starts up operations, such as after a reboot
  • At a specific time and day
  • At hourly, daily, weekly, or monthly intervals

You can schedule scripts to be run or methods to be invoked on the server. You apply the action to an entity in the inventory, such as a virtual machine or a host.

You can perform the following actions with ScheduledTaskManager.

  • Retrieve scheduled tasks for a specific managed entity by calling the ScheduledTaskManager.RetrieveEntityScheduledTask method.
  • Create a scheduled task by calling the ScheduledTaskManager.CreateScheduledTask method. See Scheduling Tasks.

ScheduledTaskManager and ScheduledTask Managed Objects shows the ScheduledTaskManager service interface and associated data objects.

Figure 1. ScheduledTaskManager and ScheduledTask Managed Objects
Shows Scheduled Task Manager and Scheduled Task with

The ScheduledTaskManager.scheduledTask property contains an array of the ScheduledTask objects configured for the server. If you have no actions scheduled, this property is empty. For any ScheduledTask objects in this array, you can use the info property of the ScheduledTask object to obtain information about the status of the scheduled action. Information includes the task’s progress, state, previous and next runtimes, and other details contained in the ScheduledTaskInfo data object.

If the action specified for a ScheduledTask creates its own Task (such as with any of the asynchronous operations), the managed object reference to the Task populates the activeTask property of ScheduledTaskInfo.