简体   繁体   English

使用WQL检索WMI属性的类型

[英]Retrieving the type of a WMI property using WQL

I can find the classes a WMI host supports using a WQL query of SELECT * FROM meta_class 我可以使用SELECT * FROM meta_class的WQL查询找到WMI主机支持的类。

This returns the classes and their methods and properties. 这将返回类及其方法和属性。 These seem to be all strings. 这些似乎都是字符串。 I'm trying to do some discovery and while having the property names is nice, getting the types of the properties would be even better. 我正在尝试进行一些发现,虽然属性名称很好,但获取属性的类型会更好。 Is it possible to get the types of the properties? 是否可以获取属性的类型?

For example, if the above query returns the class CIM_Processor with a property of Family can I tell that Family is a uint16 rather than say a uint32 or a string ? 例如,如果上述查询返回具有Family属性的CIM_Processor类,我是否可以说Familyuint16而不是uint32string I've been reading through Retrieving Class Definitions but can't seem to find a query that returns types. 我一直在阅读“ 检索类定义”,但似乎找不到返回类型的查询。 Is this even possible? 这有可能吗? Is there a workaround not using WQL? 是否有不使用WQL的解决方法?

I'm not aware of the existence of a WMI class which retrieves the properties types. 我不知道是否存在检索属性类型的WMI类。 But you can enumerate the properties of a WMI class using the SWbemPropertySet object and then access each property of the collection( SWbemProperty ) and read the value of the SWbemProperty.CIMType property. 但是,您可以使用SWbemPropertySet对象枚举WMI类的属性,然后访问集合的每个属性( SWbemProperty )并读取SWbemProperty.CIMType属性的值。 If you are using .Net you can access the same information using the PropertyData Class and the Type Property. 如果使用的是.Net,则可以使用PropertyData类和Type属性访问相同的信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM