GetMac address

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
 
S

Shawn

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
 
J

Jason

Then I suppose I can do a

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

?????
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top