Start-Task

Start-Task

Starts a task.

Syntax

Parameter Set: FromMonitoringObjectProviderPath
Start-Task [-Task] <MonitoringTask> [[-Overrides] <Hashtable> ] [[-Asynchronous]] [[-Credential] <PSCredential> ] [[-Path] <String[]> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: FromMonitoringObject
Start-Task [-Task] <MonitoringTask> [-TargetMonitoringObject] <MonitoringObject> [[-Overrides] <Hashtable> ] [[-Asynchronous]] [[-Credential] <PSCredential> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Detailed Description

Starts a task.

Parameters

-Asynchronous

Specifies whether the task should be run synchronously or asynchronously.

Aliases

none

Required?

false

Position?

5

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Credential<PSCredential>

Specifies the credentials under which to run the task.

Aliases

none

Required?

false

Position?

5

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Overrides<Hashtable>

Specifies the task overrides.

Aliases

none

Required?

false

Position?

4

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Path<String[]>

Specifies the path or a set of paths to the monitoring objects against which the task will be run. To enter more than one value, separate them by using commas.

Aliases

none

Required?

false

Position?

6

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-TargetMonitoringObject<MonitoringObject>

Specifies the monitoring object to run the task against.

Aliases

none

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Task<MonitoringTask>

Specifies the task to start. Valid values are objects that represent monitoring tasks. You can use the Get-Task cmdlet to create such objects.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Confirm

Prompts you for confirmation before executing the command.

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

Describes what would happen if you executed the command without actually executing the command.

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters

Notes

  • For more information, type "Get-Help Start-Task -detailed". For technical information, type "Get-Help Start-Task -full".
    When specifying multiple values for a parameter, use commas to separate the values. For example, "<parameter-name> <value1>, <value2>".

Examples

-------------- EXAMPLE 1 --------------

This command uses Get-Task to retrieve a task and store it in the $task variable. It then uses Start-Task to start that task.

C:\PS>$task = get-task | where-object {$_.Name -eq "MyTask"}
start-task -task $task

Get-Task

Get-TaskResult