Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Re: cleanest/most efficient way to do this

by RayRay459 (Pilgrim)
on Jan 26, 2002 at 01:22 UTC ( [id://141655]=note: print w/replies, xml ) Need Help??


in reply to Re: cleanest/most efficient way to do this
in thread cleanest/most efficient way to do this

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);

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://141655]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-04-26 06:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found