Necos,
Thank you for answering my posting. Since i work for a large company and this is for our production environment, they will not let me add a module to the machines with out it being in QA for a month. and even that gets pushed off.
here's some of the code i have been using for the pdc dump and ipaddress lookup :
#!D:\Perl\bin -w
use strict;
use Win32::NetAdmin;
open (OUT,">list.txt") ||
die "Cannot create machine list. :$!";
# This will get the list of machine names from the PDC
my @users;
Win32::NetAdmin::GetUsers("\\\\Weasel",'',\@users);
my @computers = grep { /\$$/ } @users;
foreach my $box (@computers) {
chop $box; # removes terminal char, must be $ from grep
print OUT "$box\n"; # print each $box on a newline
}
close OUT;
# this will take a file and read it in and resolve hostname
# to ip address
#####################################################################
print "What file do you want to read?";
chomp($InFile = <STDIN>);
open(IN,$InFile) ||
die "Cannot open $InFile: $!";
open(OUT,">results.txt") ||
die "Cannot create results.txt: $!";
while (<IN>) {
my $hostname = $_;
chomp $hostname;
@addr = gethostbyname($hostname); # note: an array now
splice(@addr, 0, 4); # get rid of other stuff
foreach (@addr)
{
print OUT join('.', unpack('C4', $_)) ."\t" . $hostname . "\n"
+;
}
}
close(IN);
close(OUT);