GetMac address

  • Thread starter Thread starter Jason
  • Start date Start date
J

Jason

In vb.net how do I get the mac address of my Nic card.

There are 6 total nic's in my pc, the mac that I'm looking for belongs to
the network adapter that
has the description Intel(R) PRO/1000 MT Network Connection - Packet
Scheduler Miniport

Any ideas?
Thanks
 
You could use WMI and do something similar to the following:

Private Function MacAttack() As String
Dim scope As ManagementScope = New
ManagementScope(ManagementPath.DefaultPath)
Dim query As SelectQuery = New
SelectQuery("Win32_NetworkAdapterConfiguration")
' this query returns all properties of the class
Dim searcher As ManagementObjectSearcher = New
ManagementObjectSearcher(scope, query)
Dim mo As New ManagementObject
For Each mo In searcher.Get()
If (mo.Item("IPEnabled").ToString) = True.ToString Then
'Environment.UserName Then
'MsgBox(mo.Item("MacAddress").ToString)
Try
MacAttack = (mo.Item("MacAddress").ToString)
Catch ex As Exception

End Try
End If
Next
End Function
 
Then I suppose I can do a

("Select * from Win32_NetworkAdapterConfiguration Where Description =
"Intel(R) PRO/1000 MT Network Connection - Packet
Scheduler Miniport")

?????
 
Back
Top