Getting The MAC- Address of any Computer

This Code Demonstrates the use of ManagementObjects to get the MAC ID of any computer.

Public Function GetMACID() As String
Dim macC As ManagementClass = New ManagementClass("Win32_NetworkAdapterConfiguration")
Dim moc As ManagementObjectCollection = macC.GetInstances()
Dim MACID As String = String.Empty
For Each mo As ManagementObject In moc
If (MACID.Equals(String.Empty)) Then
If CBool(mo("IPEnabled")) Then
MACID = mo("MacAddress").ToString()
End If
End If
MACID = MACID.Replace(":", "-")
Return MACID
End Function

Download Sample Application for usage Details.
Regards Hefin Dsouza


  • Download Sample Application (20882-10911-GetMacAddress.rar)
  • Comments

    No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: