Get-WASJobInstanceStatus

Applies To: Windows 8, Windows Server 2012

Get-WASJobInstanceStatus

Gets the current status of a job instance.

Syntax

Parameter Set: Default
Get-WASJobInstanceStatus [-JobInstance] <WASJobInstance[]> [ <CommonParameters>]

Detailed Description

The Get-WASJobInstanceStatus cmdlet gets the current status of the specified job instance, including the computers and the tasks running on the computers. The JobInstance parameter is required.

Parameters

-JobInstance<WASJobInstance[]>

Specifies the job instance that you want to get status for. Use the Get-WASJobInstance cmdlet to get the job instance object to use with this parameter. This is a required parameter.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

<CommonParameters>

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

Examples

Example 1: Get detailed status of a running job

The first command gets the job and saves it as a variable.

The second command gets the job instances that are running, and saves it as a variable.

The third command displays the status of the job instances.

PS C:\> $job = Get-WASJob -JobName *Automated*

PS C:\> $instance = Get-WASJobInstance -Job $job | where {$_.IsComplete -eq $false}

PS C:\> Get-WASJobInstanceStatus -JobInstance $instance

Example 2: Get a list of computers still running within a specified job instance

The first command gets the job and saves it as a variable.

The second command gets the job instances that are running, and saves it as a variable.

The third command gets the computers that are running for that job instance.

The fourth command formats the output data as a table.

PS C:\> $job = Get-WASJob -JobName *Automated*

PS C:\> $instance = Get-WASJobInstance -Job $job | where {$_.IsComplete -eq $false}

PS C:\> $runningComps = foreach ($status in Get-WASJobInstanceStatus -JobInstance $instance) { foreach ($co
mp in $status.computers) { if ($comp.Status -eq "Running") { $comp.Computer} }}

PS C:\> format-table -property ComputerName,Location,RebootRequired -inputobject $runningComps

Get-WASJob

Get-WASJobInstance

Windows Assessment Services Technical Reference