DIWbemServices.ExecMethod

[This is preliminary documentation and subject to change.]

The DIWbemServices.ExecMethod method executes a method exported by a CIM object. This method will block while the method being forwarded to the appropriate provider executes and the information and status are then returned.

CIMOM does not implement the methods directly. The method providers export the methods. For any given CIM class, the available methods and their parameters must be specified in the documentation for the provider in question.

DIWbemServices.ExecMethod(
  [in]  ObjectPath As String,                   
  [in]  MethodName As String,
  [in] lFlags As Long,                       
  [in] pCtx As Object,                 
  [in] pInParams As Object,
  [out, OPTIONAL] ppOutParams As Object,
  [out, OPTIONAL] ppCallResult As Object
) As Long
 

Parameters

ObjectPath
A string containing the object path of the object for which the method is executed.
MethodName
The name of the method for the object.
lFlags
Reserved. It must be zero.
pCtx
Typically NOTHING. Otherwise, this is a DWbemContext object required by the dynamic class provider that is producing the class instances. The values in the context object must be specified in the documentation for the provider in question.
pInParams
May be NOTHING if no in-parameters are required to execute the method. Otherwise, this is a DWbemClassObject that contains the properties. The properties act as inbound parameters for the method that is being executed. The contents of the object are method-specific. They are part of the specification for the provider in question.
PpOutParams

If not NOTHING, receives an object containing outbound parameters and return values for the method execution. The contents of this object are method-specific. They are part of the specification for the provider in question.

ppCallResult
If NOTHING, this is not used. otherwise the call returns immediately with WBEM_NO_ERROR, and ppCallResult receives a new DIWbemCallResult object. This object must be polled, using the GetCallStatus method, to obtain the result of the method execution. The out-parameters for the call are available by calling DIWbemCallResult.GetResultObject

Return Values

WBEM_E_FAILED Unspecified error.
WBEM_E_INVALID_CLASS The specified class was invalid.
WBEM_E_INVALID_PARAMETER An invalid parameter was specified, or the namespace could not be parsed.
WBEM_E_OUT_OF_MEMORY There was not enough memory to complete the operation.
WBEM_E_INVALID_METHOD The requested method was not available.
WBEM_E_ACCESS_DENIED The current user was not authorized to execute the method.
WBEM_E_INVALID_METHOD_PARAMETERS The provider determined the supplied pInParams object was invalid.
WBEM_NO_ERROR Success.

For more information on return values see Visual Basic error handeling and return values

See Also

DIWbemServices.ExecMethodAsync, DIWbemCallResult.GetResultObject