RayRay459 has asked for the wisdom of the Perl Monks concerning the following question:
# 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 = <STDIN>); open(IN,$InFile) || die "Cannot open $InFile: $!"; open(OUT,">results.txt") || die "Cannot create results.txt: $!"; while (<IN>) { ($addr) = (gethostbyname($hostname))[4]; print OUT "$hostname 's address is ", join(".",unpack("C4", $addr)), "\n"; } close(IN); close(OUT);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: getting server names in the domain and looking up ips
by tachyon (Chancellor) on Aug 07, 2001 at 21:42 UTC | |
|
Re: getting server names in the domain and looking up ips
by VSarkiss (Monsignor) on Aug 07, 2001 at 21:42 UTC | |
by RayRay459 (Pilgrim) on Aug 08, 2001 at 00:36 UTC | |
|
Re: getting server names in the domain and looking up ips
by rchiav (Deacon) on Aug 07, 2001 at 21:58 UTC |