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

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
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

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