Dim IPAdress As System.Net.IPAddress
Dim HostName As String
HostName = System.Net.Dns.GetHostName '获得本机的机器名
IPAdress = System.Net.Dns.GetHostByName(HostName).AddressList.GetValue(0) '获得本机的IP
messagebox.show(IPAdress.Tostring) '获得MAC地址
msgbox(HostName)
‘’外部引用添加:System.Management.dll
Dim mc As new System.Management.ManagementClass("Win32_NetworkAdapterConfiguration")
Dim moc = mc.GetInstances()
For Each mo As object In moc
If mo("IPEnabled").ToString() = "True"
msgbox( mo("MacAddress").ToString())
End If
Next