RE: [TUT] Get Computer Info 06-26-2011, 11:38 AM
#6
Sure you can get the ip adress of the computer... but the provided solution seems better to me, since getting the local ip can be tricky (because most pc's nowadays have more than 1 NIC... wired, wireless, virtual, etc..) so you could end up with several ip's, finally not knowing which one is the 'live' ip.. besides that, it gives you the local ip, not the wan ip ;-)
sorry, forgot the code..
using WMI to get all active NIC's and their ip addresses:
don't forget to add a reference to system.management.dll
sorry, forgot the code..
using WMI to get all active NIC's and their ip addresses:
Code:
Private Sub iptest()
Dim mc As System.Management.ManagementClass
Dim mo As ManagementObject
mc = New ManagementClass("Win32_NetworkAdapterConfiguration")
Dim moc As ManagementObjectCollection = mc.GetInstances()
Dim ips As String()
For Each mo In moc
If mo.Item("IPEnabled") = True Then
ips = mo.Item("IPAddress")
End If
Next
For i = 0 To ips.GetUpperBound(0)
MessageBox.Show(ips(i))
Next
End Subdon't forget to add a reference to system.management.dll




![[+]](https://sinister.li/images/modern/collapse_collapsed.png)