vSphere tasks are activities and actions that occur on an object within the vSphere inventory.

vSphere tasks represent system activities that do not complete immediately, such as migrating a virtual machine. For example, powering off a virtual machine is a task. You can perform this task manually every evening, or you can set up a scheduled task to power off the virtual machine every evening.

How Do You View vSphere Tasks

Learn how to view vSphere tasks that are associated with a single object or all objects in a vSphere environment.

By default, the task list for an object also includes tasks performed on its child objects. You can filter the task list by entering the object that you want in the Target column filter.

If you are logged in to a vCenter Server instance that is part of a vCenter Enhanced Linked Mode group, the Server column in the task list displays the name of the vCenter Server system on which the task is performed.

Procedure

  1. In the vSphere Client, navigate to an object in the inventory.
  2. Click the Monitor tab.
  3. Under Tasks and Events, select Tasks.
    The task list contains tasks performed on the object and detailed information, such as target, task status, initiator, and start/completion time of the task.
    You can limit the number of tasks visible in the Tasks pane by selecting an option from the Tasks per page drop-down menu.
  4. (Optional) Click the filter (Select filter) icon on a column header and filter the task list by entering your filtering criteria.
  5. (Optional) Click the expand row (Expand row) icon to view related events for a task. You can view task information about multiple tasks at the same time.
  6. (Optional) Click Open in new tab to open only the Task Console in a separate tab on your browser.

How Do You Cancel a vSphere Task

Canceling a vSphere task stops a running task from occurring. Canceling a scheduled task does not cancel subsequent runs. To cancel a scheduled task that has not run, reschedule it.

Prerequisites

Required privileges:

  • Manual tasks: Tasks.Update task
  • Scheduled tasks:Scheduled task.Remove task

Procedure

  1. Locate the task in the Recent Tasks pane.
    By default, the Recent Tasks pane is displayed at the bottom of the vSphere Client.
  2. Click the cancel button (Cancel a task.) next to the progress bar in the Status column for the task you want.
    If the cancel option is unavailable, the selected task cannot be canceled.
  3. In the Cancel Task pop-up dialog box, click OK.

Results

The vCenter Server system or ESXi host stops the progress of the task and returns the object to its previous state. The vSphere Client displays the task with a The task was canceled by a user. status.

Cancelled tasks and the corresponding events are retained in the vCenter Server database. For information about the retention of tasks and events in the vCenter Server database, and how to configure the database settings, see the vSphere Monitoring and Performance documentation.

How Do You Filter vSphere Tasks

To lower the number of vSphere tasks displayed for a single object or all objects in your environment, filter the task history in the database using several criteria, such as status, initiator, and time range.

Procedure

  1. In the vSphere Client, navigate to an object in the inventory.
  2. Click the Monitor tab.
  3. Under Tasks and Events, select Tasks.
  4. Click Filter.

    The Filter Tasks dialog opens.

  5. Filter the tasks you want to view.
    1. Select the respective check boxes in the Status options list to filter the tasks by their status.
    2. From the Type drop-down menu, select the task type.
      • User - Displays the tasks initiated by all users, such as vsphere.local users, Active Directory domain users, and system users.

      • System - Displays the tasks initiated only by system users. System users are user accounts associated with an application or service.

    3. To view the tasks initiated by all users or by specific users, select the All users or Specific users radio button.

      If you select to view the tasks performed by specific users, create a list of users.

      1. Select the domain for the users from the drop-down menu.

      2. Select the users who initiated the tasks.

        1. Enter a name in the Search box.

          The system searches from the users in the selected domain.

        2. Select a user and click Add.

    4. From the Select time set drop-down menu, select the time when the task was started, completed or queued.
    5. From the Select time range options, select the time range when the tasks were performed.
      • Relative - If you want to filter the tasks for a relative time range, specify the relative time range from the Last and Range drop-down menus.

      • Date range - If you want to filter the tasks for a specific time period, specify the date and time from the drop-down menus.

      For example, to filter the tasks that got queued for the last 2 weeks, from the Select time set drop down menu, select Queued time and select the Relative radio button. Then, from the Last drop-down menu, select 2 and from the Range drop-down menu, select Weeks.
  6. Click Filter.

Results

The Tasks page displays the tasks that match your criteria. If you want to clear the task filter, click Clear all filters in the upper-right corner.

How Do You Export vSphere Tasks

You can export the detailed information for selected vSphere tasks or all tasks listed in the Tasks page to a CSV file.

To export the information about specific tasks, you can filter the task list and then select only the tasks that you want. You can also export the information about all tasks listed for an object or all objects in the vSphere environment.

Procedure

  1. In the vSphere Client, navigate to an object in the inventory.
  2. Click the Monitor tab.
  3. Under Tasks and Events, select Tasks.
  4. (Optional) To export one or more tasks, click the check boxes in front of the respective tasks.
  5. Click Export at the top left corner of the Tasks pane.
    Note: By default, if you did not select any tasks, the detailed information about all displayed tasks is exported.
    1. (Optional) If you selected one or more tasks but you want to export the information about all displayed tasks, click All Rows.
    2. (Optional) If you want to export only the information for the selected tasks, click Selected Rows.
    The CSV file is generated and available for download.

How Do You Export vSphere Tasks with Advanced Export

You can use the advanced export option to export vSphere tasks that meet your specific criteria, such as status, initiator, and time range.

With the advanced export option for tasks, you can export up to 100 tasks that meet your specific criteria. You can use the exported information for monitoring and troubleshooting purposes. For example, you can export the tasks performed by specific users during the time range when some suspicious activity was detected.

Procedure

  1. In the vSphere Client, navigate to an object in the inventory.
  2. Click the Monitor tab.
  3. Under Tasks and Events, select Tasks.
  4. From the Export drop-down menu, select Advanced export.

    The Advanced Export Tasks dialog opens.

  5. Filter the tasks for which you want to export information.
    1. To export only tasks with specific status, select the respective check boxes in the Status options list.
    2. To export tasks based on the initiator of the tasks, select one of the options from the Type drop-down menu.
      • User - Exports tasks initiated by all users, such as vsphere.local users, Active Directory domain users, and system users.

      • System - Exports tasks initiated only by system users. System users are user accounts associated with an application or service.

    3. From the Users radio buttons, select whether to export the tasks initiated by specific users or by all users.

      If you select the Specify users radio button, you must create a list of users.

      1. From the Domain drop-down menu, select the domain for the users.

      2. Create a list of users who initiated the tasks.

        1. Enter a name in the Search text box.

          The system searches from the users in the selected domain.

        2. Select a user from the list and click Add.

    4. From the Select time set drop-down menu, select a time set that defines the time range of the exported tasks.

      You can select between start time, completion time, and queued time.

    5. From the Select time range options, select the time range for the exported tasks.
      • Relative - If you want to export the tasks for a relative time range, specify the relative time range from the Last and Range drop-down menus.

      • Data range - If you want to export the tasks for a specific time period, specify the date and time from the drop-down menus.

      For example, to export the tasks that got queued between March 13, 2022 10:30 AM and June 13, 2022 10:30 PM from the Select time set drop down menu, select Queued time. Then select the Date range radio button and specify the time period using the respective text fields.

    6. From the Include columns radio buttons, select whether you want to export the information from all columns or from specific columns.
  6. Click Export.

Results

A .csv file is generated and available for download.

Scheduling vSphere Tasks

You can schedule vSphere tasks to run once in the future or multiple times, at a recurring interval.

The vSphere tasks that you can schedule are listed in the following table.

Table 1. Scheduled Tasks
Scheduled Task Description
Add a host Adds the host to the specified data center 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 Activate or deactivate DPM for hosts in a cluster.
Change resource settings of a resource pool or virtual machine 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 Lifecycle 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 Lifecycle Manager is installed.

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.

After a scheduled task runs, you can reschedule it to run again at another time.

Note: At the time when a scheduled task is about to run, the user who created or last edited the task must be authenticated and authorized to run the task. If, for example, the user permissions to create or edit a scheduled task are removed, or the user account is deleted, the scheduled task fails with an error message. An administrator or a user with the required privileges can reschedule the task for subsequent runs.

How Do You Create a Scheduled vSphere Task

You can create scheduled tasks for operations that you want to run automatically once or at a recurring interval.

If the task to schedule is not available in the vSphere Client, use the vSphere API. See the vSphere SDK Programming Guide.

Caution: Do not schedule multiple tasks simultaneously on the same object. The results are unpredictable.

Prerequisites

Required privilege: Schedule Task.Create tasks

Note: At the time when a scheduled task is about to run, the user who created the task must still have the Schedule Task.Create tasks privileges. If the user is no longer authenticated or authorized to run the task, for example, their permissions to create a scheduled task are removed, or the user account is deleted, the scheduled task fails with an error message. An administrator or another user with the required privileges can reschedule the task for subsequent runs.

Procedure

  1. In the vSphere Client, navigate to the object for which you want to schedule a task.
  2. Select Configure > Scheduled Tasks > New Scheduled Task.
  3. From the New Scheduled Task drop-down menu, select the task to schedule.
    The Schedule New Task wizard opens for the task with the task name appended next to the name of the wizard. The wizard contains a page where you configure the scheduling options for the task.
  4. Enter the required scheduling options for the task.
    1. Enter a name and description of the task.
    2. Choose a frequency for the task.
      Option Description
      Once Runs the scheduled task at the time selected.
      After vCenter startup Runs the task a specified number of minutes after vCenter Server startup.
      Hourly
      1. Enter the repeat frequency.
      2. Enter the start date and time.
      3. Enter the end date and time.

      For example, to start a task at the half-hour mark of every fifth hour, enter 5 hours and 30 minutes.

      Daily
      1. Enter the repeat frequency.
      2. Enter the start date and time.
      3. Enter the end date and time.
      For example, to run the task at 2:30 pm every four days, enter 4 and 14:30.
      Weekly
      1. Enter the repeat frequency.
      2. Select the day of the week.
      3. Enter the start date and time.
      4. Enter the end date and time.

      For example, to run the task at 6 am every Tuesday and Thursday, enter 1 week, 6 am, and select Tuesday and Thursday.

      Monthly
      1. Enter the repeat frequency.
      2. Select the days by using one of the following methods.
        • Enter a specific day of the month and the number of months. For example, the tenth day every five months.
        • Select first, second, third, fourth, or last, and select the day of the week and the number of months.

          last runs the task on the last week in the month that the day occurs. For example, if you select the last Monday of the month and the month ends on a Sunday, the task runs six days before the end of the month.

    3. (Optional) Enter one or more email addresses to receive an email notification when the task is complete.
    To schedule some tasks, you must enter additional details for the task. For example, to schedule taking a virtual machine snapshot, the Schedule New Task (Take Snapshot) wizard opens. In the Scheduling Options page, you set the scheduling options for the task, and in the Snapshot Settings page, you enter the properties for the snapshot.
  5. Click Schedule the task.

How Do You Change or Reschedule a Scheduled vSphere Task

After a scheduled vSphere task is created, you can change the schedule, frequency, and other attributes of the task. You can edit and reschedule tasks before or after they run.

Prerequisites

Required privilege:Schedule Task.Modify

Note: At the time when a scheduled task is about to run, the user who last edited the scheduled task must still have the Schedule Task.Modify privileges. If the user is no longer authenticated or authorized to run the task, for example, their permissions to edit a scheduled task are removed, or the user account is deleted, the scheduled task fails with a warning. An administrator or another user with the required privileges can reschedule the task for subsequent runs.

Procedure

  1. In the vSphere Client, navigate to the object for which you want to edit a scheduled task.
    To view all scheduled tasks for a vCenter Server instance, navigate to that vCenter Server instance.
  2. Select Configure, and select Scheduled Tasks.
  3. Select a task from the list on the left and click Edit.
  4. Right-click the task and select Edit.
  5. Change the task attributes as necessary.
  6. Click Save.

How Do You Remove a Scheduled vSphere Task

Removing a scheduled task removes all future occurrences of the task. The history associated with all completed occurrences of the task remains in the vCenter Server database.

Prerequisites

Required privilege:Scheduled task.Remove

Procedure

  1. In the vSphere Client, navigate to the object for which you want to remove a scheduled task.
    To view all scheduled tasks for a vCenter Server instance, navigate to that vCenter Server instance.
  2. Select Configure, and select Scheduled Tasks.
  3. Select a task from the list on the left and click Remove.