I'm trying to script some DNS Atype and PTRtype data entries. I've thoroughly studied the MSDN Library createInstanceFromPropertydata method and queried DNS for pointer and A records for precise examples and every time I run this script, I recieve a Generic Failure error on the first instance of errResult on line 15. I've run this script in cscript too with no better results.
I'm using domain admin credentials. Am I just approaching this wrong?
Any help would be greatly appreciated.
I'm using domain admin credentials. Am I just approaching this wrong?
Any help would be greatly appreciated.
Code:
strDNSServer = "dnsserver.mydomain.com"
strPTRContainer = "32.1.179.in-addr.arpa"
strAContainer = "mydomain.com"
strPTROwner = "176.32.1.179.in-addr.arpa"
strPTRDomainname = "server" & "." & strAContainer
intRecordClass = 1
intTTL = 600
strIPAddress = "179.1.32.176"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strDNSServer & _
"\root\MicrosoftDNS")
Set objItem = objWMIService.Get("MicrosoftDNS_Atype")
errResult = objItem.CreateInstanceFrompropertydata _
(strDNSServer, strAContainer, strPTRDomainname, intRecordClass, intTTL, strIPAddress)
Set objItem1 = objWMIService.Get("MicrosoftDNS_PTRType")
errResult1 = objItem1.CreateInstanceFromPropertyData _
(strDNSServer, strPTRContainer, strPTROwner, intRecordClass, intTTL, strPTRDomainname)