Perform an SRV record query (Perl)
This code can be found in
Chapter 14 of DNS on Windows Server 2003
Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.
Find out how to download all of the Perl code from this site.
# Perform an SRV record query
# ---------------------------------------------------------------
# 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
# ---------------------------------------------------------------
use Win32::OLE qw(in);
use strict;
my $strDomain;
$strDomain = 'movie.edu';
my ($objDNS, $objRRs, $objRR);
$objDNS = Win32::OLE->GetObject('winMgmts:root\\MicrosoftDNS');
$objRRs = $objDNS->ExecQuery('Select * from MicrosoftDNS_SRVType ' . ' Where OwnerName = \'_ldap._tcp.gc._msdcs.' . $strDomain . '\'');
print "Global Catalogs for $strDomain\n";
foreach my $objRR (in $objRRs) {
print ' ' . $objRR->DomainName, "\n";
}
print "\n";
$objRRs = $objDNS->ExecQuery('Select * from MicrosoftDNS_SRVType ' . ' Where OwnerName = \'_ldap._tcp.dc._msdcs.' . $strDomain . '\'');
print "Domain Controllers for $strDomain\n";
foreach my $objRR (in $objRRs) {
print ' ' . $objRR->DomainName, "\n";
}
|
This code has been viewed 1247 times.
|
New from the creators of TechTasks.com:
StatSheet.com
|