0x80070032枚举WMI WebAdministration类时出现“不支持请求”错误

时间:2015-03-11 14:53:12

标签: iis wmi web-administration

我正在尝试枚举和查询远程计算机中的WMI WebAdministration类。这是C#中的代码示例,但可以从CIM Studio或WMI Tester工具完成相同的操作

ManagementScope scope = new ManagementScope();
scope.Path = new ManagementPath(@"\\" + server + @"\root\WebAdministration");
ConnectionOptions options = new ConnectionOptions();
options.Impersonation = ImpersonationLevel.Impersonate;
options.EnablePrivileges = true;
options.Authentication = AuthenticationLevel.PacketPrivacy;
scope.Options = options;
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT path FROM AuthenticationSection WHERE Path LIKE '%WebApp1%'");
searcher.Scope = scope;
foreach (ManagementObject os in searcher.Get()) //fails here
{
    Console.WriteLine("path - " + os["Path"].ToString());
}

连接指向一台远程计算机时有效,但指向另一台远程计算机时失败(错误0x80070032“请求不受支持”)。这两台机器似乎完全相同。我可能错过了一些东西,但IIS配置,安全设置,安装角色等看起来都一样。

要说明的一件重要事情是我能够在两台机器中成功查询WMI MicrosoftIISv2类。因此,此问题是WebAdministration命名空间

所特有的

搜索此错误时,似乎在问题是WMI的“外部”时抛出。还在敲打我的脑袋,找出它的来源和原因。

欣赏任何线索或想法!

0 个答案:

没有答案