I needed the same functionality, but couldn't find a pre-made solution. So, I came up 
with the following. It might not be pretty, but it does work. If anyone improves upon 
it, please re-post for the rest of it. Thanks.
 
-Henry.
 
Code to get the raw info:
 
my $ui;
open (NBTOUT, ">nbtout.txt") or die "\n\nCould not open NBTOUT.txt output file. ";

#Subnet range 10.1.1.1 to 10.1.1.250
for ($i = 1; $i < 251; $i++) {
    print "Trying 10.1.1.$i\n";
    print NBTOUT "Trying 10.1.1.$i\n";
    $ui = `nbtstat -a 10.1.1.$i`;
    print NBTOUT $ui;
    }
 
Code to get raw info clean:

open (NBTOUT2, ">nbtout2.txt") or die "\n\nCould not open NBTOUT2.txt output file. ";
$ui = `type nbtout.txt`;
$ui =~ s/MY_GUID<--Change it.//g;
$ui =~ s/Local Area Connection//g;
$ui =~ s/Node IpAddress//g;
$ui =~ s/---------------------------------------------/\t/g;
$ui =~ s/Host not found.//g;
$ui =~ s/Scope Id//g;
$ui =~ s/\\Device\\NetBT_Tcpip_\{\}:\n//g;
$ui =~ s/: \[0.0.0.0\] : \[\]//g;
$ui =~ s/\[MY_IP_ADD <--Change it.\]//g;
$ui =~ s/\[\]//g;
$ui =~ s/\s+:\s+/\n/g;
$ui =~ s/:\s+/\t/g;
$ui =~ s/\s\s\s//g;
$ui =~ s/MY_Domain<--Change it.//g;
$ui =~ s/Trying\s+//g;
$ui =~ s/\t//g;
$ui =~ s/\n.*\=//g;
print NBTOUT2 $ui;

 


        -----Original Message----- 
        From: Eric Hennessey [mailto:[EMAIL PROTECTED]] 
        Sent: Tue 11/19/2002 9:14 AM 
        To: [EMAIL PROTECTED] 
        Cc: 
        Subject: Enumerating MAC addresses on remote machines
        
        

        Hi all...
        
        Has anybody got any ideas on how to enumerate MAC addresses for all adapters
        on a remote machine?  I can do it on the local machine by parsing the output
        of ipconfig /all, but I can't seem to figure out how to get the same from a
        remote machine.
        
        Any ideas will be most appreciated!
        Eric
        _______________________________________________
        Perl-Win32-Admin mailing list
        [EMAIL PROTECTED]
        To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
        

=��Z)��f�y��X��X�����h��`�)��lz��rدy+Z��(�:.�˛���m�m����+-����b��jל�o�j)fj��˛


Reply via email to