![使用 C# 在区域上设置 DNS 服务器](https://linux22.com/image/781376/%E4%BD%BF%E7%94%A8%20C%23%20%E5%9C%A8%E5%8C%BA%E5%9F%9F%E4%B8%8A%E8%AE%BE%E7%BD%AE%20DNS%20%E6%9C%8D%E5%8A%A1%E5%99%A8.png)
我想以编程方式在 Windows Server 上创建的域上设置主 ns 服务器:
ManagementBaseObject outParams = zoneObj.InvokeMethod("CreateZone", inParams, null);ManagementClass zoneObj = new ManagementClass(session, new ManagementPath("MicrosoftDNS_Zone"), null);
ManagementBaseObject inParams = zoneObj.GetMethodParameters("CreateZone");
inParams["ZoneName"] = "mydomain.com";
inParams["ZoneType"] = 0;
inParams["DNSServer"] = "ns1.myserver.com"; //--- I am getting an error here!
ManagementBaseObject outParams = zoneObj.InvokeMethod("CreateZone", inParams, null);
我无法设置这个,但我尝试过:dnsserver,nsserver,dnsname,
一切都无法工作。