Christopher D Albert
Christopher D Albert

Reputation: 57

WQL for enumerating all classes in a namespace

I am able to use the following query successfully on WMI, but I am unable to make it more granular using the __genus property.

Works: select * from meta_class where __class like "%win32%"

Works: select * from meta_class where __class like "%win32%" and __superclass like "%process%"

Does not work: select * from meta_class where __class like "%win32%" and __genus is 1

Does not work: select * from meta_class where __genus = 1

I'm working on a C# project where I've scavenged all namespaces on a remote node, and I'm working on all classes within that namespace. I have a workaround utilizing System.Management.ManagementClass, but it is incredibly weird. Is there any way to query with the __genus property? I'm able to use other properties, but __genus seems like it doesn't work.

Thank you

Edit: Thanks megatron, totally skipped my mind to edit for code pieces

Upvotes: 2

Views: 1258

Answers (1)

Christopher D Albert
Christopher D Albert

Reputation: 57

Upon further research, the __Genus property should be available to query, however, due to the nature of a schema query, it seems to be purposefully excluded. Schema queries can only return class definitions, and not instances of a class. Class definitions always have __Genus set to 1, thereby eliminating the need to test the __Genus property of a class.

Upvotes: 1

Related Questions