Gets the resource usage of a currently running job.

Visual Basic
Edit|Remove
strClusterName = "localhost" 'Change to name of cluster if not run locally.
intJobID = 253 'Must be a currently running job.

Set objComputeCluster = CreateObject("Microsoft.ComputeCluster.Cluster")
objComputeCluster.Connect(strClusterName)
WScript.Echo "Job ID: " & intJobID
Set objJobResourceUsage = objComputeCluster.GetJobResourceUsage(intJobID)

WScript.Echo "Number Of Processes: " & objJobResourceUsage.NumberOfProcesses
WScript.Echo "Working Set: " & objJobResourceUsage.WorkingSet & " bytes"
WScript.Echo "Processors Allocated Per Node:"
Set colAllocatedNodes = objJobResourceUsage.AllocatedNodes
For Each objAllocatedNode In colAllocatedNodes
  WScript.Echo "  " & objAllocatedNode.Name & " = " & objAllocatedNode.Value
Next
WScript.Echo "Process IDs By Node:"
Set colProcessesPerNode = objJobResourceUsage.Processes
For Each strProcessesPerNode In colProcessesPerNode
  arrNodeProcesses = Split(strProcessesPerNode, ",")
  WScript.Echo "  " & arrNodeProcesses(0)
  arrProcesses = Split(Trim(arrNodeProcesses(1)))
  For Each strProcess In arrProcesses
    WScript.Echo "    " & strProcess
  Next
Next