HRESULT
ListProcessesInGuest([in] LONG options,
[in] ICallback* jobDoneCallback,
[out,retval] IJob** listJob);
This function lists the running processes in the guest operating system.
VBScript:
Set job = vm.ListProcessesInGuest(0, Nothing)
err = job.WaitWithoutResults()
If lib.ErrorIndicatesFailure(err) Then
WScript.Echo("Error: " & lib.GetErrorText(err, empty))
WScript.Quit
End If
numResults = job.GetNumProperties(VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_ITEM_NAME)
Dim prop
ReDim prop(3)
' Populate the array of properties to request.
prop(0) = VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_ITEM_NAME
prop(1) = VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_PROCESS_ID
prop(2) = VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_PROCESS_OWNER
prop(3) = VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_PROCESS_COMMAND
For i = 0 to numResults-1
err = job.GetNthProperties(i, prop, results)
QuitIfError(err)
' Unpack the results.
processName = results(0)
pid = CStr(results(1))
owner = results(2)
commandLine = results(3)
WScript.Echo(processName & " (" & pid & "): " & owner & ", " & commandLine)
Next