how to modify DNS record by script?

  • Thread starter Thread starter William Stacey
  • Start date Start date
I want to modify an existing DNS record on a Windows 2003
server (AD Integrated Zone) by means of a script.

I found the following script on the Microsoft site, and
it works fine for creating a record:

-----------------------------------------
strDNSServer = "atl-dc-03.fabrikam.com"
strContainer = "fabrikam.com"
strOwner = "workstation5.fabrikam.com"
intRecordClass = 1
intTTL = 600
strIPAddress = "192.168.1.100"

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer
& "\root\MicrosoftDNS")
Set objItem = objWMIService.Get("MicrosoftDNS_AType")
errResult = objItem.CreateInstanceFromPropertyData _
(strDNSServer, strContainer, strOwner,
intRecordClass, intTTL, strIPAddress)
------------------------------------------

But despite much searching, I have not found a way to
change the email address of an existing
record, or alternatively to delete an existing record
(and then recreate it with the script above.)

I tried using the dnsrecord.vbs included in dnsprov.zip,
but not only was it way too large for me to figure
out how to include a snippet in my own script, I couldn't
get it to modify a record for me at all.

Does anyone have any ideas? On the face of it, it should
be pretty simple.

Thanks,

Dave
 
Back
Top