NAME

Wait-HPOVTaskComplete

SYNOPSIS

Wait for a task to complete.

SYNTAX

Wait-HPOVTaskComplete [-task] <Object> [[-timeout] <TimeSpan>] [<CommonParameters>]</object>

DESCRIPTION

HP OneView utilizes a task subsystem for operations that will take longer than 200ms, and will execute them Asyncrounously.  An async task resource object is created and returned to the caller once the request has passed validation. 

This blocking cmdlet assists a caller with monitoring a specific task resource, and will wait for the given task to "complete" (get to a terminal state, including error) or timeout.  The cmdlet accepts either the task URI or resource object via pipeline. 

Once the task is no longer in a running state, the cmlet will return the task resource object.  The caller should examine the ’taskState’ property/key for the final task status.

PARAMETERS

-Task <Object>
The uri or object of the task resource to wait for.
Aliases -taskuri
Required? true
Position? 1
Default value <none>           
Accept pipeline input? false
Accept wildcard characters?    false
-timeout <TimeSpan>
The timespan to wait for the task to complete.  Default is to wait for 20 minutes.
Aliases None.
Required? true
Position? 2
Default value <none>           
Accept pipeline input? false
Accept wildcard characters?    false


<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).

INPUTS

System.String     -or-

System.Management.Automation.PSCustomObject

Accepted. You can pipeline the task URI or resource object.

OUTPUTS

System.Management.Automation.PSCustomObject

The finished Task object that includes the task result.

RELATED LINKS

EXAMPLES

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

PS C:\> Wait-HPOVTaskComplete /rest/tasks/F08EE040-DBA7-4806-BB62-993DD0CB4250
PS C:\> Waiting for task to complete...Task completed successfully!
Wait for task to complete.

-------------------------- EXAMPLE 2 --------------------------

PS C:\> Wait-HPOVTaskComplete $task –timeout (New-TimeSpan –minute 10)
PS C:\> Waiting for task to complete...Task completed successfully!
Wait for the task to complete, modifying the default timeout to 10 minutes

-------------------------- EXAMPLE 3 --------------------------

PS C:\> $svr = Get-HPOVServer "ServerA"
PS C:\> $taskResults = New-HPOVProfile -name "Profile 1" -server $svr | Wait-HPOVTaskComplete
Retreive the server details for ServerA, create a Server Profile and pass via pipeline the task resource object.

Last edited Mar 7, 2014 at 9:42 PM by ChrisLynchHP, version 9