我想使用WQL通过WMI调用一个静态方法(基本上相当于wbemtest.exe中的"Execute Method“按钮),但是我在寻找语法示例时遇到了麻烦。
我有一个名为"HelloWmi“的自定义WMI提供程序,其方法如下:
[ManagementTask]
public static string getVersion()
{
return "1.4.2";
}在wbemtest中,我可以单击"Execute Method“按钮,输入"HelloWmi”作为对象路径,然后就会出现一个要执行的方法组合框。同样,我可以在windows中运行以下命令:
C:\Windows\system32>wmic /namespace:\\root\Test path HelloWmi call getVersion
Executing (HelloWmi)->getVersion()
Method execution successful.
Out Parameters:
instance of __PARAMETERS
{
ReturnValue = "1.4.2";
};然而,对于这个项目,我并没有使用标准的windows版WMIC工具,而是通过ubuntu版的WMIC包远程访问WMI,而ubuntu版的WMIC包似乎并不支持WMIC版的别名。
有没有办法只使用WQL查询来调用WMI方法?
发布于 2011-06-09 03:45:10
No WMI monica,不可能从wmi中执行方法wmi查询只是为了检索有关sentence.the类和属性的信息,而不是为了执行wmi方法。有关执行wmi方法的详细信息,请查看以下链接
Calling a Provider Methodhttps://stackoverflow.com/questions/6283130
复制相似问题