IWbemClassObject::GetObjectText method (wbemcli.h)

The IWbemClassObject::GetObjectText method returns a textual rendering of the object in the MOF syntax. Notice that the MOF text returned does not contain all the information about the object, but only enough information for the MOF compiler to be able to re-create the original object. For instance, no propagated qualifiers or parent class properties are displayed.


HRESULT GetObjectText(
  [in]  long lFlags,
  [out] BSTR *pstrObjectText


[in] lFlags

Normally 0. If WBEM_FLAG_NO_FLAVORS is specified, qualifiers will be presented without propagation or flavor information.

[out] pstrObjectText

This must point to NULL on entry. This parameter receives from Windows Management a newly allocated BSTR that was initialized with SysAllocString. You must call SysFreeString on the pointer when the string is no longer required. This pointer points to a MOF syntax rendering of the object upon return from the call. Because this is an out parameter, the pointer must not point to a string that is valid before this method is called, because the pointer will not be deallocated.

Return value

This method returns an HRESULT indicating the status of the method call. The following list lists the value contained within an HRESULT. For general HRESULT values, see System Error Codes.


The following algorithm is used to reconstruct the text of the parameters of a method:

  1. Parameters are resequenced in the order of their identifier values.
  2. Parameters that are specified as [in] and [out] will be combined into a single parameter.


Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Target Platform Windows
Header wbemcli.h (include Wbemidl.h)
Library WbemUuid.lib
DLL CIMWin32.dll; Esscli.dll; Fastprox.dll; FrameDyn.dll; FrameDynOS.dll; Krnlprov.dll; Ncprov.dll; Wbemcore.dll; Wbemess.dll; Wmipiprt.dll

See also