@@ -0,0 +1,1533 @@
+import logging%0Aimport traceback%0A%0Afrom cim import CIM%0Afrom cim import Index%0Afrom cim.objects import ObjectResolver%0Afrom cim.objects import Moniker%0A%0A%0Adef main(type_, path):%0A    if type_ not in (%22xp%22, %22win7%22):%0A        raise RuntimeError(%22Invalid mapping type: %7B:s%7D%22.format(type_))%0A%0A    c = CIM(type_, path)%0A    i = Index(c.cim_type, c.logical_index_store)%0A    o = ObjectResolver(c, i)%0A%0A    bindings = %5B%5D%0A    ns = %22root%5C%5Csubscription%22%0A    bindingname = %22__filtertoconsumerbinding%22%0A    for instance in o.get_cd_children_ci(ns, bindingname):%0A        ci = o.get_ci(ns, bindingname, instance.instance_key)%0A        bindings.append(ci)%0A%0A    for instance in bindings:%0A        print(%22binding: %22, instance.key)%0A        filterref = instance.properties%5B%22Filter%22%5D.value%0A        consumerref = instance.properties%5B%22Consumer%22%5D.value%0A%0A        fm = Moniker(%22%5C%5C%5C%5C%22 + ns + %22:%22 + filterref)%0A        filter = o.get_ci(%22root%5C%5Csubscription%22, fm.klass, fm.instance)%0A        print(%22  filter: %22, filter)%0A        print(%22    language: %22, filter.properties%5B%22QueryLanguage%22%5D.value)%0A        print(%22    query: %22, filter.properties%5B%22Query%22%5D.value)%0A%0A        cm = Moniker(%22%5C%5C%5C%5C%22 + ns + %22:%22 + consumerref)%0A        consumer = o.get_ci(%22root%5C%5Csubscription%22, cm.klass, cm.instance)%0A        print(%22  consumer: %22, consumer)%0A        if %22CommandLineTemplate%22 in consumer.properties:%0A            print(%22    payload: %22, consumer.properties%5B%22CommandLineTemplate%22%5D.value)%0A%0A%0Aif __name__ == %22__main__%22:%0A    logging.basicConfig(level=logging.INFO)%0A    import sys%0A    main(*sys.argv%5B1:%5D)%0A

add filtertoconsumerbinding example