Quantcast
Channel: Small Business Server forum
Viewing all articles
Browse latest Browse all 8539

WmiClass in C#

$
0
0

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


Viewing all articles
Browse latest Browse all 8539

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>