1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
[WebMethod]
public string modifySOA()
{
bool verifConnect = Connection("IP du serveur");
if (verifConnect == false)
throw new System.InvalidOperationException("Connection échoué");
ManagementClass zoneObj = new ManagementClass(managementScope, new ManagementPath("MicrosoftDNS_SOAType"), null);
ManagementBaseObject inParams = zoneObj.GetMethodParameters("Modify");
// initialisation des paramètres
inParams["TTL"] = ((System.UInt32)(86400));
inParams["SerialNumber"] = ((System.UInt32)(2011042901));
inParams["PrimaryServer"] = ((System.String)("srvtest"));
inParams["ResponsibleParty"] = ((System.String)("root.####.com"));
inParams["RefreshInterval"] = ((System.UInt32)(3600));
inParams["RetryDelay"] = ((System.UInt32)(600));
inParams["ExpireLimit"] = ((System.UInt32)(1209600));
inParams["MinimumTTL"] = ((System.UInt32)(3600));
//invoke method, dispose unneccesary vars
ManagementBaseObject outParams = zoneObj.InvokeMethod("Modify", inParams, null);
if ((outParams.Properties["RR"] != null))
{
//return new ManagementPath(outParams["RR"].ToString());
return "OK";
}
return "Failed";
} |
Partager