- How to get Machine Name
Get_Machin_Name = Environment.MachineName
- How to get Mac Address
Dim mc As System.Management.ManagementClass
Dim mo As ManagementObject
Dim sMac As String = ""
mc = New ManagementClass("Win32_NetworkAdapterConfiguration")
Dim moc As ManagementObjectCollection = mc.GetInstances()
For Each mo In moc
If mo.Item("IPEnabled") = True Then
sMac = mo.Item("MacAddress").ToString()
Exit For
End If
Next
Get_MAC_IP_Add = sMac
Dim mc As System.Management.ManagementClass
Dim mo As ManagementObject
Dim sMac As String = ""
mc = New ManagementClass("Win32_NetworkAdapterConfiguration")
Dim moc As ManagementObjectCollection = mc.GetInstances()
For Each mo In moc
If mo.Item("IPEnabled") = True Then
sMac = mo.Item("MacAddress").ToString()
Exit For
End If
Next
Get_MAC_IP_Add = sMac
Comments
Post a Comment