0

I want to find the MAC address of network adopter, I have a working code too but my problem is it only works if IP addres is enabled otherwise it won't get the address is there any solution to find MAC address even if IP Enabled is false if its possible update me with sample code

Here is my code to find MAC

Dim myWMI As Object, myObj As Object, Itm
Set myWMI = GetObject("winmgmts:\\.\root\cimv2")
Set myObj = myWMI.ExecQuery("SELECT * FROM " & _
                 "Win32_NetworkAdapterConfiguration " & _
                 "WHERE IPEnabled = True")
For Each Itm In myObj
Dim macme As String
Dim NewMac As String
macme = Itm.MACAddress
NewMac = Replace(macme, ":", "")
Text1.Text = NewMac
    Exit For
Next
3
Contributors
3
Replies
13
Views
1 Year
Discussion Span
Last Post by DenisOxon
0

I tried to remove it WHERE statement but getting errors but
Yes i can if find anyother working solution, i copied this code from internet as I am new to it
any other solution to grab the mac address of LAN card only if LAN is not available then check for wireless
the only thing I required is to grab single/one MAC address that works and keep constant if IP given or not given.

Edited by hallianonline

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.