how to delete DNS A type record using Script/WMI

  • Thread starter Thread starter Samir Pandey
  • Start date Start date
S

Samir Pandey

Hello,

I am using the following code to create a A type DNS record.

Dim objMgmScope As New
ManagementScope("\\DNSServer\root\MicrosoftDNS")
Dim objPath As New ManagementPath("MicrosoftDNS_AType")
Dim objOptions As New ObjectGetOptions
Dim objClass As New ManagementClass(objMgmScope, objPath, objOptions)
Dim inParams As ManagementBaseObject =
objClass.GetMethodParameters("CreateInstanceFromPropertyData")
inParams("DnsServerName") = DNSServer
inParams("ContainerName") = DNSZone
inParams("OwnerName") = ResourceName
inParams("IPAddress") = IPAddress
Dim outParams As ManagementBaseObject =
objClass.InvokeMethod("CreateInstanceFromPropertyData", inParams,
Nothing)

This works just perfect.
Now how can i delete such record using a similar script. I cann't find
any solution on Microsoft site or rather anywhere.

thanks,
Samir
 
Back
Top