Results 1 to 5 of 5

Thread: [2008] WMI Network Information (IP Address)

Threaded View

  1. #2
    Addicted Member
    Join Date
    Mar 2008
    Posts
    143

    Re: [2008] WMI Network Information (IP Address)

    Try changing the code from...

    Code:
    For Each queryObj As ManagementObject in searcher.Get()
    
        Console.WriteLine("-----------------------------------")
        Console.WriteLine("Win32_NetworkAdapterConfiguration instance")
        Console.WriteLine("-----------------------------------")
    
        If queryObj("IPAddress") Is Nothing Then
            Console.WriteLine("IPAddress: {0}", queryObj("IPAddress"))
        Else
            Dim arrIPAddress As String()
            arrIPAddress = queryObj("IPAddress")
            For Each arrValue As String In arrIPAddress
                Console.WriteLine("IPAddress: {0}", arrValue)
            Next
        End If
    Next
    to...

    Code:
    For Each queryObj As ManagementObject in searcher.Get()
        If Not(queryObj("IPAddress") Is Nothing) Then
            Dim arrIPAddress As String()
            arrIPAddress = queryObj("IPAddress")
            For Each arrValue As String In arrIPAddress
                Console.WriteLine(arrValue)
            Next
        End If
    Next
    Last edited by michaelerice; Sep 24th, 2008 at 09:35 AM.
    Shut up and eat your banana!

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