Score:0

Set DNS Server on Zone using C#

pl flag

I would like to set the primary ns server on a domain I am creating on Windows Server programmatically:

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);

I am failing to set this but I have tried: dnsserver, nsserver, dnsname,

All cant work.

diya avatar
la flag
Does https://stackoverflow.com/a/19663743 help?
pl flag
Thanks, I saw this one. It is about integrating the zone to AD. I want to set the NS server to a different one than localhost
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.