Set-XenTask

Last published : Nov 12, 2026
Sets fields of a Task object.

Syntax

Set-XenTask [-Task] <Task> [-PassThru]
    [-Status {pending | success | failure | cancelling | cancelled | unknown}]
    [-Progress <double>] [-Result <string>] [-ErrorInfo <string[]>]
    [-OtherConfig <hashtable>] [-BestEffort] [-SessionOpaqueRef <string>] [-WhatIf]
    [-Confirm] [<CommonParameters>]
Set-XenTask [-Ref] <XenRef[Task]> [-PassThru]
    [-Status {pending | success | failure | cancelling | cancelled | unknown}]
    [-Progress <double>] [-Result <string>] [-ErrorInfo <string[]>]
    [-OtherConfig <hashtable>] [-BestEffort] [-SessionOpaqueRef <string>] [-WhatIf]
    [-Confirm] [<CommonParameters>]
Set-XenTask [-Uuid] <guid> [-PassThru]
    [-Status {pending | success | failure | cancelling | cancelled | unknown}]
    [-Progress <double>] [-Result <string>] [-ErrorInfo <string[]>]
    [-OtherConfig <hashtable>] [-BestEffort] [-SessionOpaqueRef <string>] [-WhatIf]
    [-Confirm] [<CommonParameters>]
Set-XenTask [-Name] <string> [-PassThru]
    [-Status {pending | success | failure | cancelling | cancelled | unknown}]
    [-Progress <double>] [-Result <string>] [-ErrorInfo <string[]>]
    [-OtherConfig <hashtable>] [-BestEffort] [-SessionOpaqueRef <string>] [-WhatIf]
    [-Confirm] [<CommonParameters>]

Description

Changes writable fields of a Task. Each optional parameter listed below corresponds to a field that can be set.

Parameters

-Async

If set, the operation runs asynchronously and returns a Task object that can be used to track its progress. Available only for those fields whose underlying operation supports asynchronous invocation.
Attribute Value
Type SwitchParameter
Required False
Position Named
Accepts pipeline input False

-BestEffort

If set, the cmdlet continues processing further objects instead of throwing a terminating error when an operation fails for one object.
Attribute Value
Type SwitchParameter
Required False
Position Named
Accepts pipeline input False

-Confirm

Prompts for confirmation before running the cmdlet.
Attribute Value
Type SwitchParameter
Required False
Position Named
Accepts pipeline input False
Aliases cf

-ErrorInfo

Set the task error info
Attribute Value
Type string[]
Required False
Position Named
Accepts pipeline input False

-Name

The name of the Task to operate on.
Attribute Value
Type string
Required True
Position 0
Accepts pipeline input True (ByPropertyName)
Aliases name_label

-OtherConfig

Set the other\_config field of the given task.
Attribute Value
Type hashtable
Required False
Position Named
Accepts pipeline input False

-PassThru

If set, the cmdlet returns the affected object. By default the cmdlet does not generate any output.
Attribute Value
Type SwitchParameter
Required False
Position Named
Accepts pipeline input False

-Progress

Set the task progress
Attribute Value
Type double
Required False
Position Named
Accepts pipeline input False

-Ref

The Task object to operate on, specified by its opaque reference.
Attribute Value
Type XenRef[Task]
Required True
Position 0
Accepts pipeline input True (ByPropertyName)
Aliases opaque_ref

-Result

Set the task result
Attribute Value
Type string
Required False
Position Named
Accepts pipeline input False

-SessionOpaqueRef

The session object on which to run the cmdlet. This overrides the default session and lets you target a specific open XenServer connection.
Attribute Value
Type string
Required False
Position Named
Accepts pipeline input False

-Status

Set the task status
Attribute Value
Type task_status_type
Required False
Position Named
Accepts pipeline input False
Accepted values pending, success, failure, cancelling, cancelled, unknown

-Task

The Task object to operate on.
Attribute Value
Type Task
Required True
Position 0
Accepts pipeline input True (ByValue)

-Uuid

The UUID of the Task to operate on.
Attribute Value
Type guid
Required True
Position 0
Accepts pipeline input True (ByPropertyName)

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.
Attribute Value
Type SwitchParameter
Required False
Position Named
Accepts pipeline input False
Aliases wi

Inputs

  • Task
  • XenRef[Task]
  • guid
  • string

Outputs

  • Task
  • Task
  • void

Examples

Example 1: Set a status

PS> Get-XenTask -Name "Demo Task" | Set-XenTask -Status pending
Set the task status

Example 2: Set a progress

PS> Get-XenTask -Name "Demo Task" | Set-XenTask -Progress 0.0
Set the task progress

Example 3: Set a result

PS> Get-XenTask -Name "Demo Task" | Set-XenTask -Result "new value"
Set the task result
  • Class: Task
  • Using the XenServer PowerShell module