how to delete DNS A type record using Script/WMI

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top