Sure:
public void CreateRR(string zoneName, string rrTextRep)
{
if ( zoneName == null )
throw new ArgumentNullException("zoneName", "zoneName is null.");
if ( rrTextRep == null )
throw new ArgumentNullException("rrTextRep", "rrTextRep is null.");
InvokeMethodOptions options = new InvokeMethodOptions();
options.Timeout = new TimeSpan(0,0,0,5);
ManagementClass rrClass = new ManagementClass(
ms,
new ManagementPath("MicrosoftDNS_ResourceRecord"),
null);
//Get an input parameters object for this method
ManagementBaseObject inParams =
rrClass.GetMethodParameters("CreateInstanceFromTextRepresentation");
//Fill in input parameter values
//inParams["DnsServerName"] = null; //Don't need.
inParams["ContainerName"] = zoneName;
inParams["TextRepresentation"] = rrTextRep;
//Execute the method
try
{
ManagementBaseObject outObject = rrClass.InvokeMethod
("CreateInstanceFromTextRepresentation", inParams, null);
PropertyDataCollection outProperties = outObject.Properties;
foreach (PropertyData outProperty in outProperties)
{
Console.WriteLine("Property = " + outProperty.Name);
}
}
catch
{
throw new ApplicationException("CreateInstanceFromTextRepresentation
method failed.");
}
} // End CreateInstanceFromTextRepresentation Method.
--
William Stacey, DNS MVP
Leigh said:
William,
I would really appreciate it if you would send me an example. please send
to leigh DOT pointer AT subzero-solutions DOT net
Thank you, Leigh
...