Results 1 to 8 of 8

Thread: [RESOLVED] [2005] WMI IPAddress Array Help

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2006
    Posts
    250

    Resolved [RESOLVED] [2005] WMI IPAddress Array Help

    Hi Everyone,

    I need your help with breaking out data within an array. The below code is a WMI query on your local machine that should output your IP addresses via a message box.

    My problem is that when I run the code, the message box displays "System.String[]". I know this is because machines may have multiple IPs and they stored in this array.

    My question is, how do I output the data within this array? ANY help would be greatly appreciated.

    Here is a link from Microsoft outlining the IPAddress aray http://msdn2.microsoft.com/en-us/library/aa394217.aspx



    Code:
    Imports System.Management
    Public Class Form1
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Dim manScope As ManagementScope
            Dim manPath As ManagementPath
            Dim manClass As ManagementClass
            Dim manObj As ManagementObject
            Dim manObjCol As ManagementObjectCollection
            Dim output As String = String.Empty
            Dim RemoteMachineName As String
    
            RemoteMachineName = "."
    
            Try
    
                manPath = New ManagementPath("\\" & RemoteMachineName & "\root\CIMV2:Win32_NetworkAdapterConfiguration")
                manScope = New ManagementScope(manPath)
    
                manClass = New ManagementClass(manScope, manPath, Nothing)
                manObjCol = manClass.GetInstances()
    
                For Each manObj In manObjCol
                    MsgBox(manObj("IPAddress").ToString)
                Next
    
            Catch ex As Exception
                ' MessageBox.Show(ex.Message)
            Finally
                manPath = Nothing
                manScope = Nothing
                manClass = Nothing
                manObjCol = Nothing
            End Try
        End Sub
    End Class
    Last edited by Giraffe Frenzy; May 21st, 2007 at 08:58 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width