Can the MAC address of a computer which is not in the LAN be found using
this method?
Or... is there a method to find the mac address of a computer by its IP?

Thanks.

Teddy


----- Original Message ----- 
From: "Erich Beyrent" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, May 18, 2005 8:38 PM
Subject: Re: Wintel MAC address fetch


> Jan Miller wrote:
> > new to Perl, have need to fetch MAC address from local machine.  Can
> > anyone provide a code snippet to get me pointing in the correct
> > direction???
> >
> > Thanks
> >
> > Jan...
>
> #!/usr/bin/perl
>
> use Win32::NetAdmin;
>   $ref = {};
>   $host = $ARGV[0] || Win32::NodeName();
>   my $trans;
>   my $rtn;
>   if (Win32::NetAdmin::GetTransports( "\\\\$host", $ref)) {
>     foreach $trans (keys %{$ref}) {
>       if( $ref->{$trans}->{'transport_name'} =~ /NetBT_/) {
>         $rtn = $ref->{$trans}->{'transport_address'};
>         $rtn =~ s/(.{2})(.{2})(.{2})(.{2})(.{2})(.{2})/$1\ $2\ $3\ $4\
> $5\ $6/;
>         $rtn = uc( $rtn );
>         last;
>       }
>     }
>   }
>   print "MAC-Address for \"$host\": $rtn\n";
>
> -Erich-
> _______________________________________________
> Perl-Win32-Users mailing list
> [email protected]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to