Dim macAddress As String = ""
For Each nic As System.Net.NetworkInformation.NetworkInterface In System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()
If nic.OperationalStatus = Net.NetworkInformation.OperationalStatus.Up And nic.GetPhysicalAddress.ToString.Length = 12 Then
macAddress = nic.GetPhysicalAddress.ToString
End If
Next
IP
Code (VB.NET)
Dim ip As String = ""
Dim strHostName As String = System.Net.Dns.GetHostName()
Dim iphe As System.Net.IPHostEntry = System.Net.Dns.GetHostEntry(strHostName)
For Each ipheal As System.Net.IPAddress In iphe.AddressList
If ipheal.AddressFamily = System.Net.Sockets.AddressFamily.InterNetwork Then
ip = ipheal.ToString()
End If
Next