C#中的WmiClass - 未知参考详细信息 [英] WmiClass in C# - Unknown reference details
本文介绍了C#中的WmiClass - 未知参考详细信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好
这是我的代码。
< span class =code-sdkkeyword> String dnsServerName = localhost;
ManagementScope范围=
新 ManagementScope( @ \\ + dnsServerName + \\root \\ MicrosoftDNS跨度>);
scope.Connect();
ManagementClass cmiClass =
new ManagementClass(范围,
new ManagementPath( MicrosoftDNS_AType),
空跨度>);
ManagementBaseObject inParams =
wmiClass.GetMethodParameters( CreateInstanceFromPropertyData );
inParams [ DnsServerName] = 此跨度> .ServerName;
inParams [ ContainerName] = zone;
inParams [ OwnerName] = hostName + 。 + zone;
inParams [ IPAddress] = iPAddress;
cmiClass.InvokeMethod( CreateInstanceFromPropertyData,inParams, null );
我能够成功引用''ManagementClass'。
但是我用google搜索并用谷歌搜索但我不明白如何正确引用wmiClass。
请可以有人帮助我。
谢谢
解决方案
wmiClass改为cmiClass
谢谢Sergey和Ganesh !! :)
Hello
Here is my code.
String dnsServerName = "localhost";
ManagementScope scope =
new ManagementScope(@"\\" + dnsServerName + "\\root\\MicrosoftDNS");
scope.Connect();
ManagementClass cmiClass =
new ManagementClass(scope,
new ManagementPath("MicrosoftDNS_AType"),
null);
ManagementBaseObject inParams =
wmiClass.GetMethodParameters("CreateInstanceFromPropertyData");
inParams["DnsServerName"] = this.ServerName;
inParams["ContainerName"] = zone;
inParams["OwnerName"] = hostName + "." + zone;
inParams["IPAddress"] = iPAddress;
cmiClass.InvokeMethod("CreateInstanceFromPropertyData", inParams, null);
I was able to reference ''ManagementClass'' successfully.
But I have googled and googled but I don''t understand how to reference wmiClass correctly.
Please can some one help me.
Thanks
解决方案
wmiClass changed to cmiClass
Thank you Sergey and Ganesh!! :)
这篇关于C#中的WmiClass - 未知参考详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文