Name

ListProcessesInGuest

Description

HRESULT
ListProcessesInGuest([in] LONG options,
                     [in] ICallback* jobDoneCallback,
                     [out,retval] IJob** listJob);

This function lists the running processes in the guest operating system.

Parameters

options
Must be 0.
jobDoneCallback
An ICallback instance that will be called when the operation is complete.
listJob
Returns an IJob object that describes the state of this asynchronous operation.

Return Value

HRESULT

Remarks

Side Effects

None.

Requirements

VixCOM.h, since VMware Workstation 6.0
Minimum Supported Guest OS: Microsoft Windows NT Series, Linux

Example


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
prop(4) = VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_PROCESS_BEING_DEBUGGED
prop(5) = VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_PROCESS_START_TIME
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)
   isDebugged = results(4)
   startTime = results(5)
   WScript.Echo(processName & " (" & pid & "): " & owner & ", " & commandLine ", " & "isDebugged: , " & isDebugged & ", " & startTime)
Next

Set results = Nothing
Set job = Nothing

Copyright (C) 2007-2010 VMware, Inc. All rights reserved.