Click here to Skip to main content
15,888,461 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Pl help to get the MAC address along with Network card detail of all disable & enable wifi as well as ethernet but it shows only ethernet mac

What I have tried:

Public Function getMacAddress()
Dim nics() As NetworkInterface = NetworkInterface.GetAllNetworkInterfaces()
Return nics(1).GetPhysicalAddress.ToString
End Function
Posted
Updated 13-Oct-17 8:13am
Comments
Richard Deeming 13-Oct-17 13:24pm    
Your code is only accessing the address of the second network interface.

If you want the address of all network interfaces, you'll need to loop over the list returned from GetAllNetworkInterfaces.

1 solution

See here: Retrieving IP and MAC addresses for a LAN[^] - the code is in C#, but it's pretty simple and if you can't work it out, online converter exist which will help: Code Converter[^]

If you are planning on using this for a security or copy protection system, you should be aware that MAC addresses are 1) not unique, and 2) easy to spoof.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900