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()
mo.Dispose()
End If
End If
Next
MACID = MACID.Replace(":", "-")
Return MACID
End Function
[\CODE]
Download Sample Application for usage Details.
================================================================================
Regards Hefin Dsouza
