IWbemServices::ExecMethod

[This is preliminary documentation and subject to change.]

The IWbemServices::ExecMethod method executes a method exported by a CIM object. The method call is forwarded to the appropriate provider where it executes, and information and status are returned to the caller, which blocks until the circuit is complete.

Methods are not directly implemented by CIMOM, but are exported by method providers. For any given CIM class, the available methods and their parameters must be specified in the documentation for the provider in question.

HRESULT IWbemServices::ExecMethod(
  [in] BSTR bstrObjectPath,                   
  [in] BSTR MethodName,
  [in] LONG lFlags,                       
  [in] IWbemContext *pCtx,                 
  [in] IWbemClassObject *pInParams,
  [out, OPTIONAL] IWbemClassObject **ppOutParams,
  [out, OPTIONAL] IWbemCallResult **ppCallResult
);
 

Parameters

bstrObjectPath
A valid BSTR 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 NULL. Otherwise, this is a pointer to an IWbemContext 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 NULL if no inbound parameters are required to execute the method. Otherwise, this points to an IWbemClassObject that contains the properties acting as inbound parameters for the method execution. The contents of the object are method-specific, and are part of the specification for the provider in question.
ppOutParams
If not NULL, receives a pointer to the outbound parameters and return values for the method execution. The contents of this object are method-specific, and are part of the specification for the provider in question. The caller must call Release on the returned object when it is no longer required.
ppCallResult
If NULL, this is not used. If ppCallResult is specified it must be set to point to NULL on entry. In this case, the call returns immediately with WBEM_NO_ERROR. ppCallResult receives a pointer to a new IWbemCallResult object, which must be polled to obtain the result of the method execution using the GetCallStatus method. The out-parameters for the call are available by calling IWbemCallResult::GetResultObject

Return Values

WBEM_E_FAILED Other unspecified errors.
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_TRANSPORT_FAILURE The communications link between the client and CIMOM has failed.
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 supplied pInParams object was determined by the provider to be invalid.
WBEM_NO_ERROR The call succeeded.

On failure, you can obtain any available information from the COM function GetErrorInfo.

See Also

IWbemServices::ExecMethodAsync, IWbemCallResult::GetResultObject