Mapping Integer Property Values to Strings
Many of the properties defined in CIM contain integer values that represent status or configuration information. The qualifiers for those properties define a mapping to human-readable string values.
This example shows a general-purpose routine for converting an integer value to the corresponding string value. The example assumes that the client library you are using has support for introspecting class property information available in the qualifiers.
The following function expects three parameters:
use wbemlib
use connection
 
function map_instance_property_to_string( connection, instance, prop )
   class_info = connection.GetClass( instance.classname, includeQualifiers=True )
   qualifiers = class_info.properties[ prop ].qualifiers
   if qualifiers.key( ‘ValueMap’ ) and qualifiers.key( ‘Values’ )
      strings = qualifiers[ ‘Values’ ]
      nums = qualifiers[ ‘ValueMap’ ]
      prop_val = instance[ prop ]
      for ( i=0; len( nums ) - 1; i++ )
         if str( nums[ i ] ) == str( prop_val )
            return strings[ i ]
   return Null