use Win32::NetAdmin;
 
$hostname = Win32::NodeName; 
 
if(Win32::NetAdmin::GetTransports( "\\\\$hostname", $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 "The MAC address is $rtn\n";
 
 
----- Original Message -----
Sent: Wednesday, February 26, 2003 11:04 AM
Subject: MAC address

All,

 

Does anyone know of a way to find out the local systems MAC address through PERL?  I would need the program to work on WIN95/98, NT4, 2K and XP.

 

Thanks,

 

Darin

 

Reply via email to