Imports System.Management
Dim search As New ManagementObjectSearcher("SELECT * FROM Win32_NetworkAdapterConfiguration Where IPEnabled=True")
Dim info As ManagementObject
Dim strIPAddress As String = Nothing
For Each info In search.Get
If Not (info("IPAddress")) Is Nothing Then
Dim i As Integer
With GrdView
.Rows.Add()
i = GrdView.Rows.Count - 1
Rows(i).Cells(1).Value = info("Description").ToString
End With
'GET THE IP ADDRESS FOR SPECIFIC NETWORK ADAPTER
Dim sql As String = "SELECT * FROM Win32_NetworkAdapterConfiguration Where IPEnabled=True
And Description='" & info("Description").ToString & "'"
Dim searchIP As New ManagementObjectSearcher(sql)
Dim infoIP As ManagementObject
For Each infoIP In searchIP.Get
strIPAddress = Join(infoIP("IPAddress"), ",")
strIPAddress = Mid(strIPAddress, 1, InStr(strIPAddress, ",") - 1)
GrdView.Rows(i).Cells(2).Value = strIPAddress
Next
End If
Next
Dim search As New ManagementObjectSearcher("SELECT * FROM Win32_NetworkAdapterConfiguration Where IPEnabled=True")
Dim info As ManagementObject
Dim strIPAddress As String = Nothing
For Each info In search.Get
If Not (info("IPAddress")) Is Nothing Then
Dim i As Integer
With GrdView
.Rows.Add()
i = GrdView.Rows.Count - 1
Rows(i).Cells(1).Value = info("Description").ToString
End With
'GET THE IP ADDRESS FOR SPECIFIC NETWORK ADAPTER
Dim sql As String = "SELECT * FROM Win32_NetworkAdapterConfiguration Where IPEnabled=True
And Description='" & info("Description").ToString & "'"
Dim searchIP As New ManagementObjectSearcher(sql)
Dim infoIP As ManagementObject
For Each infoIP In searchIP.Get
strIPAddress = Join(infoIP("IPAddress"), ",")
strIPAddress = Mid(strIPAddress, 1, InStr(strIPAddress, ",") - 1)
GrdView.Rows(i).Cells(2).Value = strIPAddress
Next
End If
Next
No comments:
Post a Comment