getting mac add of the system

svibuk

Active member
Joined
Jul 15, 2008
Messages
31
Programming Experience
1-3
VB.NET:
 Dim nic As Net.NetworkInformation.NetworkInterface
            Dim keyadd As String
            For Each nic In Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces
                keyadd = nic.GetPhysicalAddress.ToString

                If keyadd = "" Then
                    MsgBox("no add")
                Else
                    MsgBox(keyadd)

                End If
            Next

i need to get the mac add of the system . i have the above code
i do get the mac add but in the loop i get more than one mac add and some time blank also.

i need to get a single unique mac add which is unique to each system
 
Getting 0 or more than 1 doesn't seem unreasonable since it's possible that a system may not have a network interface or may have multiple (i.e. both ethernet and wi-fi). When there are multiple values, you may be able to check the NetworkInterfaceType value for each one and only use certain types.
 
Back
Top