# Managed Object - Task(vim.Task)

Property of
  ClusterAttemptedVmInfo, ClusterPowerContext, ManagedEntity, ScheduledTaskInfo, StoragePlacementResult, TaskInfo, TaskInProgress, TaskManager, VsanAttachToSrOperation, VsanClusterHealthQuerySpec, VsanClusterVmdkLoadTestResult, VsanFileServiceOvfSpec, VsanResourceCheckSpec, VsanResourceCheckTaskDetails, VsanUpgradeSystemUpgradeHistoryItem
Parameter to
  GetVsanPerfDiagnosisResult, VsanRollbackVdsToVss
Returned by
  AbortCustomization_Task, AddDisks_Task, AddDVPortgroup_Task, AddHost_Task, AddStandaloneHost_Task, ApplyEntitiesConfig_Task, ApplyEvcModeVM_Task, ApplyHostConfig_Task, ApplyStorageDrsRecommendation_Task, ApplyStorageDrsRecommendationToPod_Task, AttachDisk_Task, AttachScsiLunEx_Task, BatchAddHostsToCluster_Task, BatchAddStandaloneHosts_Task, CertMgrRefreshCACertificatesAndCRLs_Task, CertMgrRefreshCertificates_Task, CertMgrRevokeCertificates_Task, ChangeKey_Task, CheckAddHostEvc_Task, CheckAnswerFileStatus_Task, CheckClone_Task, CheckCompatibility_Task, CheckCompliance_Task, CheckConfigureEvcMode_Task, CheckHostPatch_Task, CheckInstantClone_Task, CheckMigrate_Task, CheckPowerOn_Task, CheckProfileCompliance_Task, CheckRelocate_Task, CheckVmConfig_Task, CloneVApp_Task, CloneVM_Task, CloneVStorageObject_Task, CnsAttachVolume, CnsConfigureVolumeACLs, CnsCreateVolume, CnsDeleteVolume, CnsDetachVolume, CnsExtendVolume, CnsQueryAsync, CnsUpdateVolumeMetadata, CompositeHostProfile_Task, ConfigureDatastoreIORM_Task, ConfigureEvcMode_Task, ConfigureHCI_Task, ConfigureHostCache_Task, ConfigureStorageDrsForPod_Task, configureVcha_Task, ConfigureVFlashResourceEx_Task, ConnectNvmeControllerEx_Task, ConsolidateVMDisks_Task, CopyDatastoreFile_Task, CopyVirtualDisk_Task, CreateChildVM_Task, CreateDisk_Task, CreateDiskFromSnapshot_Task, CreateDVPortgroup_Task, CreateDVS_Task, CreateNvdimmNamespace_Task, CreateNvdimmPMemNamespace_Task, createPassiveNode_Task, CreateScreenshot_Task, CreateSecondaryVM_Task, CreateSecondaryVMEx_Task, CreateSnapshot_Task, CreateSnapshotEx_Task, CreateVirtualDisk_Task, CreateVM_Task, createWitnessNode_Task, CryptoUnlock_Task, CustomizeGuest_Task, CustomizeVM_Task, DatastoreExitMaintenanceMode_Task, DefragmentVirtualDisk_Task, DeleteDatastoreFile_Task, DeleteNvdimmBlockNamespaces_Task, DeleteNvdimmNamespace_Task, DeleteSnapshot_Task, DeleteVirtualDisk_Task, DeleteVStorageObject_Task, DeleteVStorageObjectEx_Task, deployVcha_Task, Destroy_Task, destroyVcha_Task, DetachDisk_Task, DetachScsiLunEx_Task, DisableEvcMode_Task, DisableSecondaryVM_Task, DisconnectHost_Task, DisconnectNvmeControllerEx_Task, DVPortgroupRollback_Task, DVSManagerExportEntity_Task, DVSManagerImportEntity_Task, DvsReconfigureVmVnicNetworkResourcePool_Task, DVSRollback_Task, EagerZeroVirtualDisk_Task, EnableSecondaryVM_Task, EnterMaintenanceMode_Task, EstimateStorageForConsolidateSnapshots_Task, EvacuateVsanNode_Task, ExitMaintenanceMode_Task, ExportAnswerFile_Task, ExtendDisk_Task, ExtendHCI_Task, ExtendVirtualDisk_Task, GenerateHostConfigTaskSpec_Task, GenerateHostProfileTaskList_Task, GenerateLogBundles_Task, HostCloneVStorageObject_Task, HostCreateDisk_Task, HostDeleteVStorageObject_Task, HostDeleteVStorageObjectEx_Task, HostExtendDisk_Task, HostInflateDisk_Task, HostReconcileDatastoreInventory_Task, HostRelocateVStorageObject_Task, HostUpdateVStorageObjectMetadata_Task, HostUpdateVStorageObjectMetadataEx_Task, HostVStorageObjectCreateDiskFromSnapshot_Task, HostVStorageObjectCreateSnapshot_Task, HostVStorageObjectDeleteSnapshot_Task, HostVStorageObjectRevert_Task, HttpNfcLeasePullFromUrls_Task, ImportCertificateForCAM_Task, InflateDisk_Task, InflateVirtualDisk_Task, InitializeDiskMappings, InitializeDisks_Task, initiateFailover_Task, InstallHostPatch_Task, InstallHostPatchV2_Task, InstallIoFilter_Task, InstantClone_Task, JoinDomain_Task, JoinDomainWithCAM_Task, LeaveCurrentDomain_Task, MakePrimaryVM_Task, MarkAsLocal_Task, MarkAsNonLocal_Task, MarkAsNonSsd_Task, MarkAsSsd_Task, MarkPerenniallyReservedEx_Task, MergeDvs_Task, MigrateVM_Task, MountVmfsVolumeEx_Task, MoveDatastoreFile_Task, MoveDVPort_Task, MoveHostInto_Task, MoveInto_Task, MoveIntoFolder_Task, MoveVirtualDisk_Task, PerformClusterPowerAction, PerformDvsProductSpecOperation_Task, PerformVsanUpgrade_Task, PerformVsanUpgradeEx, PerformVsanUpgradePreflightAsyncCheck_Task, PowerDownHostToStandBy_Task, PowerOffVApp_Task, PowerOffVM_Task, PowerOnMultiVM_Task, PowerOnVApp_Task, PowerOnVM_Task, PowerUpHostFromStandBy_Task, prepareVcha_Task, PromoteDisks_Task, QueryHostPatch_Task, QueryVMotionCompatibilityEx_Task, RebootHost_Task, RebuildDiskMapping, RecommissionVsanNode_Task, ReconcileDatastoreInventory_Task, ReconfigureCluster_Task, ReconfigureComputeResource_Task, ReconfigureDatacenter_Task, ReconfigureDVPort_Task, ReconfigureDVPortgroup_Task, ReconfigureDvs_Task, ReconfigureHostForDAS_Task, ReconfigVM_Task, ReconnectHost_Task, RectifyDvsHost_Task, RectifyDvsOnHost_Task, RefreshStorageDrsRecommendationsForPod_Task, RegisterChildVM_Task, RegisterVM_Task, RelayoutObjects, reloadVirtualMachineFromPath_Task, RelocateVM_Task, RelocateVStorageObject_Task, RemoveAllSnapshots_Task, RemoveDatastoreEx_Task, RemoveDisk_Task, RemoveDiskEx, RemoveDiskMapping_Task, RemoveDiskMappingEx, RemoveSnapshot_Task, Rename_Task, ResetVM_Task, ResignatureUnresolvedVmfsVolume_Task, ResolveInstallationErrorsOnCluster_Task, ResolveInstallationErrorsOnHost_Task, ResolveMultipleUnresolvedVmfsVolumesEx_Task, RetrieveKmipServersStatus_Task, RevertToCurrentSnapshot_Task, RevertToSnapshot_Task, RevertVStorageObject_Task, ScanHostPatch_Task, ScanHostPatchV2_Task, SearchDatastore_Task, SearchDatastoreSubFolders_Task, setClusterMode_Task, ShrinkVirtualDisk_Task, ShutdownHost_Task, StageHostPatch_Task, StampAllRulesWithUuid_Task, StartGuestNetwork_Task, StartIODiagnosticsTask, StartIoInsight, StartRecording_Task, StartReplaying_Task, StopIoInsight, StopRecording_Task, StopReplaying_Task, SuspendVApp_Task, SuspendVM_Task, TerminateFaultTolerantVM_Task, TurnDiskLocatorLedOff_Task, TurnDiskLocatorLedOn_Task, TurnOffFaultToleranceForVM_Task, UninstallHostPatch_Task, UninstallIoFilter_Task, UnmapVmfsVolumeEx_Task, UnmountDiskMapping_Task, UnmountDiskMappingEx, UnmountVmfsVolumeEx_Task, UnregisterAndDestroy_Task, unregisterVApp_Task, UpdateAnswerFile_Task, UpdateDVSHealthCheckConfig_Task, UpdateDVSLacpGroupConfig_Task, UpdateProductLockerLocation_Task, UpdateVirtualMachineFiles_Task, UpdateVsan_Task, UpdateVStorageInfrastructureObjectPolicy_Task, UpdateVStorageObjectCrypto_Task, UpdateVStorageObjectPolicy_Task, UpdateVVolVirtualMachineFiles_Task, UpgradeIoFilter_Task, UpgradeTools_Task, UpgradeVM_Task, ValidateHostProfileComposition_Task, VCenterUpdateVStorageObjectMetadataEx_Task, VsanAddStoragePoolDisk, VsanAttachVsanSupportBundleToSr, VsanClusterCreateFsDomain, VsanClusterCreateShareSnapshot, VsanClusterReconfig, VsanClusterReconfigureFsDomain, VsanClusterRemoveFsDomain, VsanClusterRemoveShare, VsanClusterRemoveShareSnapshot, VsanCreateDatastoreSource, VsanCreateFileShare, VsanDeleteObjects_Task, VsanDeleteStoragePoolDisk, VsanDestroyDatastoreSource, VsanDownloadAndInstallVendorTool_Task, VsanDownloadFileServiceOvf, VsanDownloadHclFile_Task, VsanEncryptedClusterRekey_Task, VsanFlashScsiControllerFirmware_Task, VsanHealthRepairClusterObjectsImmediate, VsanHealthUpdateDefaultDSPolicyRecommendation, VsanHostPerformResourceCheck, VsanHostUpdateFirmware, VsanHostWipeDisk, VsanPerfCreateStatsObjectTask, VsanPerfDeleteStatsObjectTask, VsanPerfDiagnoseTask, VsanPerformOnlineHealthCheck, VsanPerformResourceCheck, VsanQueryVcClusterHealthSummaryTask, VsanQueryVcClusterNetworkPerfTask, VsanRebalanceCluster, VsanRebalanceFileService, VsanReconfigureFileShare, VsanRemediateIscsiLunsRuntimeStatus, VsanRemediateVsanCluster, VsanRemediateVsanHost, VsanStopRebalanceCluster, VsanUnmountDiskMappingEx, VsanUnmountStoragePoolDisks, VsanUpdateDatastoreSource, VsanUpgradeFsvm, VSANVcAddWitnessHost, VsanVcAddWitnessHostForClusters, VsanVcClusterRunVmdkLoadTest, VSANVcConvertToStretchedCluster, VSANVcRemoveWitnessHost, VsanVcReplaceWitnessHostForClusters, VSANVcSetPreferredFaultDomain, VsanVdsMigrateVss, VsanVibInstall_Task, VsanVitAddIscsiLUN, VsanVitAddIscsiTarget, VsanVitEditIscsiLUN, VsanVitEditIscsiTarget, VsanVitRemoveIscsiLUN, VsanVitRemoveIscsiTarget, VsanVssMigrateVds, VStorageObjectCreateSnapshot_Task, ZeroFillVirtualDisk_Task
Extends
  ExtensibleManagedObject
See also
  LocalizableMessage, MethodFault, TaskInfo, TaskInfoState
Since
  2.0

## Managed Object Description

A task is used to monitor and potentially cancel long running operations.

Properties

Name | Type | Description
--- | --- | ---
info | TaskInfo | Detailed information about this task.
Properties inherited from ExtensibleManagedObject
availableField, value

Methods

Methods defined in this Managed Object
CancelTask, SetTaskDescription, SetTaskState, UpdateProgress
Methods inherited from ExtensibleManagedObject
setCustomValue

# CancelTask(cancel)

Cancels a running or queued task. A task may only be canceled if it is cancelable. Multiple cancel requests will be treated as a single cancelation request. Canceling a completed or already canceled task will throw an InvalidState exception.

If a task is canceled, its runtime state will be set to error and its error state will be set to RequestCanceled.

A cancel operation is asynchronous. The operation may return before the task is canceled.

Required Privileges
  None

Parameters

Name | Type | Description
--- | --- | ---
_this | ManagedObjectReference | A reference to the Task used to make the method call.

Return Value

Type | Description
--- | ---
None

Faults

Type | Description
--- | ---
InvalidState | Thrown if the task is already canceled or completed.
RuntimeFault | Thrown if any type of runtime fault is thrown that is not covered by the other faults; for example, a communication error.

Events

Type
None

Show WSDL type definition
<element xmlns="http://www.w3.org/2001/XMLSchema" xmlns:vsan="urn:vsan" name="CancelTask" type="vsan:CancelTaskRequestType"/> <element xmlns="http://www.w3.org/2001/XMLSchema" xmlns:vsan="urn:vsan" name="CancelTaskResponse"> <complexType/> </element>

# SetTaskDescription(UpdateDescription)

Updates task description to describe the current phase of the task.

Required Privileges
  Task.Update
Since
  vSphere API 4.0

Parameters

Name | Type | Description
--- | --- | ---
_this | ManagedObjectReference | A reference to the Task used to make the method call.
description P | LocalizableMessage | New description for task Since vSphere API 4.0

P Required privilege: description

Return Value

Type | Description
--- | ---
None

Faults

Type | Description
--- | ---
RuntimeFault | Thrown if any type of runtime fault is thrown that is not covered by the other faults; for example, a communication error.

Events

Type
None

Show WSDL type definition
<element xmlns="http://www.w3.org/2001/XMLSchema" xmlns:vsan="urn:vsan" name="SetTaskDescription" type="vsan:SetTaskDescriptionRequestType"/> <element xmlns="http://www.w3.org/2001/XMLSchema" xmlns:vsan="urn:vsan" name="SetTaskDescriptionResponse"> <complexType/> </element>

# SetTaskState(setState)

Sets task state and optionally sets results or fault, as appropriate for state

Required Privileges
  Task.Update
Since
  VI API 2.5

Parameters

Name | Type | Description
--- | --- | ---
_this | ManagedObjectReference | A reference to the Task used to make the method call.
state P | TaskInfoState | New state for task Since VI API 2.5
result* P | xsd:anyType | Result to set, valid only if task state is TaskInfo.State.success Since VI API 2.5
fault* P | MethodFault | Fault to set, valid only if task state is error. The fault must be a of a fault type that directly or indirectly extends VimFault. Since VI API 2.5

*Need not be set P Required privilege - see tooltip for details

Return Value

Type | Description
--- | ---
None

Faults

Type | Description
--- | ---
InvalidState | Thrown if attempting to change states after task is completed or in error, or attempting to set the result or fault incorrectly
RuntimeFault | Thrown if any type of runtime fault is thrown that is not covered by the other faults; for example, a communication error.

Events

Type
None

Show WSDL type definition
<element xmlns="http://www.w3.org/2001/XMLSchema" xmlns:vsan="urn:vsan" name="SetTaskState" type="vsan:SetTaskStateRequestType"/> <element xmlns="http://www.w3.org/2001/XMLSchema" xmlns:vsan="urn:vsan" name="SetTaskStateResponse"> <complexType/> </element>

# UpdateProgress

Sets percentage done for this task and recalculates overall percentage done. If a percentDone value of less than zero or greater than 100 is specified, a value of zero or 100 respectively is used.

Required Privileges
  Task.Update
Since
  VI API 2.5

Parameters

Name | Type | Description
--- | --- | ---
_this | ManagedObjectReference | A reference to the Task used to make the method call.
percentDone P | xsd:int | Percentage to set for this task Since VI API 2.5

P Required privilege: percentDone

Return Value

Type | Description
--- | ---
None

Faults

Type | Description
--- | ---
InvalidState | Thrown if task is not running
OutOfBounds | VirtualCenter 2.x servers throw this fault if percentDone is less than 0 or greater than 100. Newer versions behave as described above, and never throw this fault.
RuntimeFault | Thrown if any type of runtime fault is thrown that is not covered by the other faults; for example, a communication error.

Events

Type
None

Show WSDL type definition
<element xmlns="http://www.w3.org/2001/XMLSchema" xmlns:vsan="urn:vsan" name="UpdateProgress" type="vsan:UpdateProgressRequestType"/> <element xmlns="http://www.w3.org/2001/XMLSchema" xmlns:vsan="urn:vsan" name="UpdateProgressResponse"> <complexType/> </element>