Hi!
I've got sample code in C#:
Code:
public void CreateHostSameAsParent()
{
try
{
ManagementScope scope = new ManagementScope( \"\\\\\\\\.\\\\root\\\\MicrosoftDNS\" );
ManagementClass classInstance = new ManagementClass( scope, new ManagementPath( \"MicrosoftDNS_AType\" ), null );
ManagementBaseObject inParams = classInstance.GetMethodParameters( \"CreateInstanceFromPropertyData\" );
inParams[\"ContainerName\"] = \"xxxx.com\";
inParams[\"DnsServerName\"] = \"myserver\";
inParams[\"IPAddress\"] = \"0.0.0.0\";
inParams[\"OwnerName\"] = \"xxxx.com\";
inParams[\"RecordClass\"] = 1;
ManagementBaseObject outParams = classInstance.InvokeMethod( \"CreateInstanceFromPropertyData\", inParams, null );
}
catch ( ManagementException err )
{
MessageBox.Show( \"An error occurred while trying to execute the WMI method: \" + err.Message );
}
}
Bye,
Lasso
www.webdot.hu
webdesign, developing, web hosting automation