I'm trying to enumerate and query a WMI WebAdministration class in remote machines. This is a code sample in C#, but same operation can be done from CIM Studio or WMI Tester tool
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());
}
This works when connecting pointing to one remote machine, but fails when pointing to another (with the error 0x80070032 "The request is not supported"). These 2 machines are seemingly identical. I might have missed something, but IIS config, security settings, installed roles, etc. look the same.
One important thing to state is that I'm able to successfully query WMI MicrosoftIISv2 classes in both machines. So this problem is unique to WebAdministration namespace
Searching around for this error, it seems to be thrown when the issue is "external" to WMI. Still banging my head to find out where it is coming from and why.
Appreciate any leads or ideas!
User contributions licensed under CC BY-SA 3.0