D
davidw
I found zonetype is really strange, someone mentions zonetype need to be
different for win 2003 and win 2000, I am using win 2000, I use the
following code to create dns zone:
ManagementScope oScope = new
ManagementScope("\\\\"+serverName+"\\ROOT\\MicrosoftDNS");
ManagementPath Path = new ManagementPath("MicrosoftDNS_Zone");
ManagementClass DnsZoneClass = new ManagementClass(oScope, Path,
null);
ManagementBaseObject InputParams =
DnsZoneClass.GetMethodParameters("CreateZone");
InputParams["ZoneName"] = zoneName;
InputParams["ZoneType"] = zoneType;
if(dataFileName!="")
InputParams["DataFileName"] = dataFileName;
ManagementBaseObject OutParams =
DnsZoneClass.InvokeMethod("CreateZone", InputParams, null);
as I read from other post, zonetype should be 0 for primary zone on win
2003, and 1 on win 2000. I tried 0,1 and 2, it returns like this:
0 - Active Directory zone (create successuflly, but not I want, I need
primary zone)
1 - returns "general failure"
2 - returns "invalid parameter"
Any idea? I have two DNS server, I need the code to create primary zone on
first server, and second zone on second server, can I do that?
Thanks for help!
different for win 2003 and win 2000, I am using win 2000, I use the
following code to create dns zone:
ManagementScope oScope = new
ManagementScope("\\\\"+serverName+"\\ROOT\\MicrosoftDNS");
ManagementPath Path = new ManagementPath("MicrosoftDNS_Zone");
ManagementClass DnsZoneClass = new ManagementClass(oScope, Path,
null);
ManagementBaseObject InputParams =
DnsZoneClass.GetMethodParameters("CreateZone");
InputParams["ZoneName"] = zoneName;
InputParams["ZoneType"] = zoneType;
if(dataFileName!="")
InputParams["DataFileName"] = dataFileName;
ManagementBaseObject OutParams =
DnsZoneClass.InvokeMethod("CreateZone", InputParams, null);
as I read from other post, zonetype should be 0 for primary zone on win
2003, and 1 on win 2000. I tried 0,1 and 2, it returns like this:
0 - Active Directory zone (create successuflly, but not I want, I need
primary zone)
1 - returns "general failure"
2 - returns "invalid parameter"
Any idea? I have two DNS server, I need the code to create primary zone on
first server, and second zone on second server, can I do that?
Thanks for help!