# Ray Espinoza # GetDomainServers.pl # Get servers in my domain and and sends the output to a #text file. ############################################################ 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("\\\\PDC",'',\@users); my @computers = grep { /\$$/ } @users; @computers = join("\n",@computers); print OUT @computers; close(OUT); # Ray Espinoza # getip.pl # 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 = ); open(IN,$InFile) || die "Cannot open $InFile: $!"; open(OUT,">results.txt") || die "Cannot create results.txt: $!"; while () { ($addr) = (gethostbyname($hostname))[4]; print OUT "$hostname 's address is ", join(".",unpack("C4", $addr)), "\n"; } close(IN); close(OUT);