ActiveXperts Network Component DnsServer Object
DNS is the Domain Name System. DNS converts machine names to the IP addresses that all machines on the net have. It translates (i.e. 'maps') from name to address and from address to name, and some other things. The Network Component DNS objects can be used to query servers running a domain name service (DNS) application. It will send domain name query packets to any designated DNS server. There are three data elements required in order to formulate a DNS query using Network Component:
- DNS servername/address
- Internet style address that is being queried
- Type of record you are searching for
The Dns objects are part of the Network Component. Overview of all Network Component objects:
DnsServer & DnsRecord - Ftp & FtpFile - Http - Icmp - IPtoCountry - Msn - Ntp - Radius - Rsh - Scp - SFtp - Ssh - SnmpManager - SnmpTrapManager - SnmpMibBrowser - Tcp - Tftp - TraceRoute - Udp - Xen - Wake-on-LAN - Xen (Citrix)
Dns Sample code
VBScript sample: Query a DNS server for all records of a given domain name
Set objDnsServer = CreateObject ( "ActiveXperts.DnsServer") ' Create object Set objConstants = CreateObject ( "ActiveXperts.ASConstants") objDnsServer.Host = "ns1.interstroom.nl" ' DNS server objDnsServer.Lookup "activexperts.com", objConstants.asDNS_TYPE_ANY ' Show all DNS records WScript.Echo "Lookup, result: " & objDnsServer.LastError If( objDnsServer.LastError <> 0 ) Then WScript.Quit End If If ( objDnsServer.IsAuthoritative = True ) Then WScript.Echo "Server is an authority for this domain" Else WScript.Echo "Server is not an authority for this domain" End If Set objDnsRecord = objDnsServer.GetFirstRecord ' Iterate over all records; get first While ( objDnsServer.LastError = 0 ) Select Case objDnsRecord.Type Case objConstants.asDNS_TYPE_A WScript.Echo "Type : A" WScript.Echo "Name : " & objDnsRecord.Name WScript.Echo "IPv4 Address : " & objDnsRecord.Address Case objConstants.asDNS_TYPE_AAAA WScript.Echo "Type : AAAA" WScript.Echo "Name : " & objDnsRecord.Name WScript.Echo "IPv6 Address : " & objDnsRecord.Address Case objConstants.asDNS_TYPE_CNAME WScript.Echo "Type : CNAME" WScript.Echo "Name : " & objDnsRecord.Name WScript.Echo "Alias : " & objDnsRecord.Address Case objConstants.asDNS_TYPE_MX WScript.Echo "Type : MX" WScript.Echo "Name : " & objDnsRecord.Name WScript.Echo "Preference : " & objDnsRecord.Preference WScript.Echo "Mail Exchange : " & objDnsRecord.MailExchange Case objConstants.asDNS_TYPE_NS WScript.Echo "Type : NS" WScript.Echo "Name : " & objDnsRecord.Name WScript.Echo "Name Server : " & objDnsRecord.NameServer Case objConstants.asDNS_TYPE_PTR WScript.Echo "Type : PTR" WScript.Echo "Name : " & objDnsRecord.Name WScript.Echo "Host : " & objDnsRecord.Address Case objConstants.asDNS_TYPE_SOA WScript.Echo "Type : SOA" WScript.Echo "Name : " & objDnsRecord.Name WScript.Echo "Name Server : " & objDnsRecord.NameServer WScript.Echo "MailBox : " & objDnsRecord.MailBox WScript.Echo "Serial : " & objDnsRecord.SerialNumber WScript.Echo "Refresh : " & objDnsRecord.RefreshInterval WScript.Echo "Retry Interval : " & objDnsRecord.RetryInterval WScript.Echo "Expiration Limit : " & objDnsRecord.ExpirationLimit WScript.Echo "Minimum TTL : " & objDnsRecord.MinimumTTL End Select WScript.Echo "TTL : " & objDnsRecord.TTL WScript.Echo Set objDnsRecord = objDnsServer.GetNextRecord ' Iterate over all records; get next Wend
You can download the full samples here.