Scripting DNS With ADSI 
Author Message
 Scripting DNS With ADSI

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



Fri, 19 Aug 2005 04:39:11 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Scripting DNS With ADSI

2. Update DNS, WINS, DNS Suffix with Script -- support VPN users

3. Update DNS, WINS, DNS Suffix with Script -- support VPN users

4. VBS Script to Create DNS Reverse Lookup Zones in Win2K Server

5. Script DNS Change

6. How script for DNS

7. DNS script help

8. AD integrated DNS scripting

9. IS there a way to change DNS and WINS server addresses using Scripts

10. REQ: Scripts for dynamic DNS updates

11. scripting AD integrated DNS

12. Script to insert DNS Server addresses

 

 
Powered by phpBB® Forum Software