问题
tl;dr What should I SELECT
instead of *
in order to get the methods?
More info:
Here's an example:
using (var s = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM someClass"))
foreach (var obj in s.Get())
If I just ask for one property it's not enough - I get an exception when trying obj.InvokeMethod(...);
.
If I ask for *
it is enough but I rather avoid this if possible.
I don't see any property for getting the methods (-Disable
, Enable
,...) in the docs for WMI classes. And if it's not on the list - how come *
works? Isn't it just supposed to ask for all of those on the list?
EDIT
Someone suggested using ManagementClass instead of ManagementObjectSearcher
. Does this load all properties like *
? (If not, that's a good answer. Though in my actual case I need a property besides the ability to call a method. And my theoretical questions remains - is *
more than just all.)
来源:https://stackoverflow.com/questions/49798851/how-to-get-methods-from-wmi