2
我想通過WMI使用WQL調用靜態方法(基本上相當於wbemtest.exe中的「執行方法」按鈕),但我在查找語法示例時遇到問題。通過WQL查詢調用WMI方法
我有一個名爲「HelloWmi」用下面的方法自定義WMI提供程序:
[ManagementTask]
public static string getVersion()
{
return "1.4.2";
}
在WBEMTEST我可以點擊「執行方法」按鈕,進入「HelloWmi」爲對象的路徑,我m提供了一個要執行的方法的組合框。同樣,我可以在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工具,而是通過WMIC包的Ubuntu,這似乎並沒有遠程訪問WMI以支持Windows的WMIC別名。
有什麼方法可以使用WQL查詢來調用WMI方法嗎?
謝謝!看來我會爲它寫一個web服務。 :) – 2011-06-08 22:37:59