Checks whether any task of a job has finished, failed or been cancelled.

Visual Basic
Edit|Remove
intJobID = 100 'Must be an existing job.

Set objComputeCluster = CreateObject("Microsoft.ComputeCluster.Cluster")
objComputeCluster.Connect("localhost")

WScript.Echo "Compute Cluster Name: " & objComputeCluster.Name
WScript.Echo "Job " & intJobID

Set objJob = objComputeCluster.GetJob(intJobID)

WScript.Echo "  Task Count: " & objJob.TaskCount
Set objJobCounter = objComputeCluster.GetJobCounter(intJobID)
If (objJobCounter.NumberOfFinishedTasks + _
    objJobCounter.NumberOfFailedTasks + _
    objJobCounter.NumberOfCancelledTasks) > 0 Then
    WScript.Echo "  At least one task has finished, failed or been cancelled."
Else
    WScript.Echo "  No tasks have finished, failed or been cancelled."
End If