Get a system IP Addr, MAC Addr, Computer Name


Following is the VB.net code used maintain User Log.

Imports System.Net


 
'-----------GET MACHINE NAME--->
MachineName = System.Environment.MachineName

'-----------GET IP ADDRESS OF THE MACHINE NAME--->
Dim myIPs As System.Net.IPHostEntry = System.Net.Dns.GetHostByName(MachineName)
For Each myIP As System.Net.IPAddress In myIPs.AddressList
IPaddress = myIP.ToString()
Next
'-----------GET MAC(PHYSICAL) ADDRESS OF THE MACHINE NAME--->
Dim theNetworkInterfaces() As System.Net.NetworkInformation.NetworkInterface = System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()
For Each currentInterface As System.Net.NetworkInformation.NetworkInterface In theNetworkInterfaces
MACAddress = currentInterface.GetPhysicalAddress().ToString
Exit Sub
Next


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: