2011年9月17日 星期六

取得本機 MAC 位址

參考1
參考2
參考3
-------------
Dim netAddress As String = ""
Dim netName As String = ""
Dim searcher As New Management.ManagementObjectSearcher("select * from win32_NetworkAdapterConfiguration")
Dim moc2 As Management.ManagementObjectCollection = searcher.Get()
For Each mo As Management.ManagementObject In moc2
If CBool(mo("IPEnabled")) Then '判断是否是网卡
netName = mo.Properties("caption").Value.ToString '网卡名称
netAddress = mo.Properties("MACAddress").Value.ToString 'mac地址
End If
Next

沒有留言:

張貼留言