SWbemObjectEx.GetText_ method

The GetText_ method of the SWbemObjectEx object returns an XML representation of an object or instance. The text file is formatted in the XML format specified as shown in WbemObjectTextFormatEnum.

For an explanation of this syntax, see Document Conventions for the Scripting API.


strObj = .GetText_( _
  ByVal iTextFormat, _
  [ ByVal iFlags ], _
  [ ByVal objWbemNamedValueSet ] _


iTextFormat [in]

Required. A value from WbemObjectTextFormatEnum that specifies the resulting XML format.

iFlags [in, optional]

Reserved operation flags. The default value is 0 (zero).

objWbemNamedValueSet [in, optional]

An SWbemNamedValueSet object that sets context for the operation. The default is null. For more information about the name/value pairs permitted, see Remarks below.

Return value

This method has no return values.

Error codes

After completion of the GetText_ method, the Err object may contain one of the error codes in the following table.

Error (Name/Dec/Hex)Meaning
2147749889 (0x80041001)

Unspecified error.

2147749890 (0x80041002)

The requested format was not found.

2147749896 (0x80041008)

One of the parameters to the call is not correct.

2147749898 (0x8004100A)

An internal, critical, and unexpected error occurred. Report this error to Microsoft Technical Support.


When constructing your SWbemNamedValueSet, only the following name/value pairs are permitted.


If TRUE, only locally defined properties and methods are present in the resulting XML. The default is FALSE.


If TRUE, qualifiers of classes, instances, properties, and methods are included in the resulting XML. The default is FALSE.


Default is 0 (zero). Possible values are:

  • 0: A <CLASS> or <INSTANCE> element is created depending on whether the object is a class or instance.
  • 1: A <VALUE.NAMEDOBJECT> element is generated.
  • 2: A <VALUE.OBJECTWITHLOCALPATH> element is generated.
  • 3: A <VALUE.OBJECTWITHPATH> element is generated.

If TRUE, system properties, like __NAMESPACE, are excluded from the output.


If TRUE, the class origin attribute is set on the <PROPERTY> and <METHOD> elements. The default is FALSE.


For more information about creating an SWbemNamedValueSet, see SWbemNamedValueSet.Add.


The following script shows how to obtain an XML representation of the Win32_Bios class definition. By specifying a particular instance of Win32_Bios, you can obtain that object's data in XML.

' Connect to the default namespace (root\cimv2) with the default
' impersonation level ("impersonate") and obtain a Win32_Bios class
' object.
Set obj = GetObject("winmgmts:win32_bios")

' Use the value for the desired XML CIM DTD format. 
XMLDtd = 1
Text = obj.GetText_(XMLDtd)
wscript.echo Text


Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2003

Type library






© 2014 Microsoft