' Create an A and PTR record
' ---------------------------------------------------------------
' From the book "DNS on Windows Server 2003"
' By Cricket Liu, Matt Larson & Robbie Allen
' Publisher: O'Reilly and Associates
' ISBN: 0-596-00562-8
' Book web site: http://rallenhome.com/books/dnsonw2k3/toc.html
' ---------------------------------------------------------------
option explicit
Dim strRR, strReverseRR, strDomain, strReverseDomain
' A record to add
strRR = "matrix.movie.edu. IN A 192.168.64.13"
strDomain = "movie.edu"
' PTR record to add
strReverseRR = "13.64.168.192.in-addr.arpa IN PTR matrix.movie.edu"
strReverseDomain = "168.192.in-addr.arpa."
Dim objDNS, objRR, objDNSServer, objRR2, objOutParam
set objDNS = GetObject("winMgmts:root\MicrosoftDNS")
set objRR = objDNS.Get("MicrosoftDNS_ResourceRecord")
set objDNSServer = objDNS.Get("MicrosoftDNS_Server.Name="".""")
' Create the A record
Dim strNull
strNull = objRR.CreateInstanceFromTextRepresentation( _
objDNSServer.Name, _
strDomain, _
strRR, _
objOutParam)
set objRR2 = objDNS.Get(objOutParam)
WScript.Echo "Created Record: " & objRR2.TextRepresentation
set objOutParam = Nothing
' Create the PTR record
strNull = objRR.CreateInstanceFromTextRepresentation( _
objDNSServer.Name, _
strReverseDomain, _
strReverseRR, _
objOutParam)
set objRR2 = objDNS.Get(objOutParam)
WScript.Echo "Created Record: " & objRR2.TextRepresentation
|