Dim theManagementScope As New Management.ManagementScope("\\Computer Name\root\cimv2")
Dim theQueryString As String
theQueryString = "SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = 1"
Dim theObjectQuery As New Management.ObjectQuery(theQueryString)
Dim theSearcher As New Management.ManagementObjectSearcher(theManagementScope, theObjectQuery)
Dim theResultsCollection As Management.ManagementObjectCollection = theSearcher.Get()
For Each currentResult As Management.ManagementObject In theResultsCollection
MessageBox.Show(currentResult("MacAddress").ToString())
Next
ปล.
อย่าลืมไป Add reference
System.Management
แล้วตรง computer name ก็เปลี่ยนเป็นชื่อเครื่องนะครับ