473,396 Members | 1,775 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

GetMac address

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
Feb 14 '06 #1
5 2139
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

Feb 14 '06 #2
Then I suppose I can do a

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

?????

"Shawn" <Te*********@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
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

Feb 14 '06 #3
Will this also retrieve wireless ethernet card MAC's?
--
Dennis in Houston
"Shawn" wrote:
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

Feb 15 '06 #4
Yes
Dennis wrote:
Will this also retrieve wireless ethernet card MAC's?
--
Dennis in Houston
"Shawn" wrote:
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


Feb 15 '06 #5
Thanks.
--
Dennis in Houston
"Shawn" wrote:
Yes
Dennis wrote:
Will this also retrieve wireless ethernet card MAC's?
--
Dennis in Houston
"Shawn" wrote:
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


Feb 16 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Alexander N. Spitzer | last post by:
If I have a machine with 3 virtual IP addresses (192.168.1.), how can I start 3 instances of the same RMI application (each started with different properties/configs), each listening on the port...
8
by: YAN | last post by:
Hi, I want to get the mac address from a machine, which i have the IP address of that machine, how can i do that? I know how to get the mac address of the local machine from the following code: ...
12
by: johny smith | last post by:
I am trying to figure out a way to print the address of what called a certain function once inside the function. I am assuming that this information is on the stack somewhere. But can someone...
7
by: Privacy Advocate | last post by:
//crossposted to: comp.lang.javascript, alt.comp.lang.javascript in an effort to get factual answers from JavaScript experts// Simply put; Is it possible to obtain the real (actual) IP address of...
33
by: baumann.Pan | last post by:
hi all, i want to get the address of buf, which defined as char buf = "abcde"; so can call strsep(address of buf, pointer to token);
4
by: Henrik Dahl | last post by:
Hello! The getmac.exe program under Windows XP lists the MAC adresses of the physical network cards. How may I obtain these MAC addresses using .NET? Best regards, Henrik Dahl
4
by: andreas.w.h.k. :-\) | last post by:
How do I change the address location in the wsdl <wsdl:port name="SearchSoap12" binding="tns:SearchSoap12"> <soap12:address location="http://searchservices/engine/search.asmx" /> </wsdl:port> ...
1
by: Phoenix_ver10 | last post by:
I have a mailing list with multiple names going to the same addresses. I need one address with all the names for that address on it. I checked out the example on microsoft's site, but A: It doesn't...
4
by: Macca | last post by:
Hi, I am using an asynchronous socket server to allow comms between multiple clients and my server. I know how to obtain the IPAddress of the client (network device) as shown below :- string...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.