I have found this great script which will enable me to
update a DNS entry via ADSI. The only problem is I can't
get it to retrieve the existing IP address before I make
the change. I know this could be done via a ping or WMI
but there must be a way of adjusting this code to get the
IP address?
Thanks in advance
Set Container = GetObject("LDAP://" & srvrname
& "/CN=MicrosoftDNS,CN=System," & domobj)
Set NewDNS = Container.Create("dnsZone", "DC=" & dname)
NewDNS.Setinfo
Set container = Nothing
Set NewDNS = Nothing
Set Container = GetObject("LDAP://" & srvrname & "/DC=" &
dname _
& ",CN=MicrosoftDNS,CN=System," & domobj)
at_drecord = _
Array(cnvt.CvHexStr2vOctetStr(at_drecord),cnvt. _
CvHexStr2vOctetStr
("0400010005F000000200000000000E100000000000000000" _
& ip_address))
at.dnsrecord = at_drecord
at.Setinfo
Set at = Nothing
Wscript.Echo "Creating www Record..."
Set WWW = Container.Create("dnsNode", "DC=www")
www_str
= "0400010005F000000200000000000E100000000000000000" _
& ip_address
www.dnsRecord = cnvt.CvHexStr2vOctetStr(www_str)
www.Setinfo
Set www = Nothing
Wscript.Echo "Setting FTP IP Address..."
Set ftp_host = Container.Create("dnsNode", "DC=ftp")
ftp_host_str
= "0400010005F000000600000000000E100000000000000000" _
& FTP_IP
ftp_host.dnsrecord = cnvt.CvHexStr2vOctetStr(ftp_host_str)
ftp_host.Setinfo
Set ftp_host = Nothing