Print zone list (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.
# Print the list of zones on a server
# ---------------------------------------------------------------
# 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);
$strServer = 'terminator.movie.edu';
$strUsername = 'dnsadmin';
$strPassword = 'dnspwd';
$objLocator = Win32::OLE->new('WbemScripting.SWbemLocator');
$objDNS = $objLocator->ConnectServer($strServer, 'root\\MicrosoftDNS', $strUsername, $strPassword);
$objDNSServer = $objDNS->Get('MicrosoftDNS_Server.Name="."');
$objZones = $objDNS->ExecQuery('Select * from MicrosoftDNS_Zone ' . 'Where DnsServerName = \'' . $objDNSServer->Name . '\'');
print $objDNSServer->Name, "\n";
foreach my $objZone (in $objZones) {
print ' ' . $objZOne->Name, "\n";
}
|
This code has been viewed 930 times.
|
New from the creators of TechTasks.com:
StatSheet.com
|