
mrcactu5
Novice
Jan 15, 2009, 7:26 AM
Post #5 of 8
(990 views)
|
|
Re: [FishMonger] Remote DNS Management
[In reply to]
|
Can't Post
|
|
Exhibit A, the Perl/WMI script which returns DNS properties (it's adapted from a book):
print "content-type: text\n\n"; use Win32::OLE 'in'; $Win32::OLE::Warn = 3; # ------ SCRIPT CONFIGURATION ------ $strServer = '192.168.0.123'; # e.g. dns1.rallencorp.com # ------ END CONFIGURATION --------- # Instantiate a WMI object for the target server $objLocator = Win32::OLE->new("WbemScripting.SWbemLocator"); $objDNS = $objLocator->ConnectServer($strServer, 'root\\MicrosoftDNS' ); # Get an instance of the MicrosoftDNS_Server class $objDNSServer = $objDNS->Get('MicrosoftDNS_Server.Name="."'); # Iterate over each property using Properties_ print $objDNSServer->Properties_->Item('Name')->Value . ':', "\n"; foreach my $objProp (in $objDNSServer->Properties_) { print $objProp->Name, "\n"; for my $k (keys %{$objProp}) { print "\t", "$k => ${$objProp}{$k}", "\n"; } } The output if I run it on command line is:
E:\blah>perl dnsProperties.pl Name Value => server Name => Name IsLocal => 1 Origin => CIM_ManagedSystemElement CIMType => 8 Qualifiers_ => Win32::OLE=HASH(0x1bbc2ac) IsArray => 0 Now let's run the same code on another computer in the LAN, but DNS now hides the value of "Name":
http://mysite.com/cgi-bin/dnsProperties.pl Name Value => Name => Name IsLocal => 0 Origin => CIM_ManagedSystemElement CIMType => 8 Qualifiers_ => Win32::OLE=HASH(0x193dfac) IsArray => 0 In all cases, names have been changed to protect the innocent. :-)
|