Checks whether all tasks of a job have finished, failed or been cancelled.

Visual Basic
Edit|Remove
intJobID = 108 '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.NumberOfNotSubmittedTasks + _
    objJobCounter.NumberOfQueuedTasks + _
    objJobCounter.NumberOfRunningTasks) > 0 Then
    WScript.Echo "  Not all tasks have finished, failed or been cancelled."
Else
    WScript.Echo "  All tasks have finished, failed or been cancelled."
End If