Listing SRV records for a domain

R

raghuramji

Folks,
I need a solution to list all the srv records for a domain
programmatically. I tried it using DnsQuery ,but i couldn't list all
srv records. I can take the srv records using that owner record name.

If anybody know the solution ,please post it.

Thanks,
RAM G
 
K

Kevin D. Goodknecht Sr. [MVP]

In
Folks,
I need a solution to list all the srv records for a
domain programmatically. I tried it using DnsQuery ,but i
couldn't list all srv records. I can take the srv records
using that owner record name.

If anybody know the solution ,please post it.


I don't think you are going to be able to do this for an entire domain. A
domain has different nodes and an SRV record exists within several different
nodes.
Here is some examples of nodes SRV records should exist in:
_ldap._tcp.dc._msdcs.dnsdomainname
_ldap._tcp.pdc._msdcs.dnsdomainname
 
H

Herb Martin

Folks,
I need a solution to list all the srv records for a domain
programmatically. I tried it using DnsQuery ,but i couldn't list all
srv records. I can take the srv records using that owner record name.

If anybody know the solution ,please post it.


This perl script seems to work but I whipped it up quickly
and didn't fully test it (other than to see it work):
(If you don't have perl see www.ActiveState.com

#begin Perl

$server = "ns1.domain.com";
$zone = "domain.com";

#run: dnscmd serverName /zoneprint zoneName
@dnscmd = `dnscmd $server /zoneprint $zone`;

foreach (@dnscmd) {
next unless /\sSRV\s/;
$node = $1 if (/^(\S+\s+)/);
$_ = "$node$_" if /^\s+\[Aging:/;
print ;
}

# end Perl

I spent most of the time expanding the first record
in a series of similar records (same domain name/node)
so that each was complete. If you don't want that 'feature'
drop all but the "print;" of the foreach loop.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top