title: VBscript for use with multiple IP addresses
body: <p>I'm trying to write a script in vbscript but being a near noob and online tutorials didn't work, I had to resort to posting here asking for help.</p>
  
  <p>The script that I've mixed and match from different sources displays domain, user, computer name, ip address. The script is working. However in certain environment, a user could potentially have multiple IP addresses and when displaying in MsgBox, only the last IP address result is returned and in many cases, that's wrong.</p>
  
  <p>I would like to know how I add/can store the address in an array and have MsgBox display the other IP addresses if there was more than one result. </p>
  
  <p>Thank you.</p>
  
  <hr>
  
  <p>Script attached below:</p>
  
  <pre><code>Option Explicit
  DIM WshNetwork, strComputer, IPConfigSet, objWMIService, IPConfig, i, j, strIP, title, message, colItems, objItem
  DIM arrIPAddress, columnC, strIPAddress, testIP(3)
  
  Set WshNetwork = WScript.CreateObject("WScript.Network")
  
  strComputer = "."
  Set objWMIService = GetObject("winmgmts:" _
      &amp; "{impersonationLevel=impersonate}!\\" &amp; strComputer &amp; "\root\cimv2")
  
  Set IPConfigSet = objWMIService.ExecQuery _
      ("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE")
  
  Set objWMIService = GetObject("winmgmts:\\" &amp; strComputer &amp; "\root\CIMV2") 
  Set colItems = objWMIService.ExecQuery( _
      "SELECT * FROM Win32_NetworkAdapterConfiguration",,48) 
  For Each objItem in colItems 
      If isNull(objItem.IPAddress) Then
      Else
          Wscript.Echo "IPAddress: " &amp; Join(objItem.IPAddress, ",")
          strIP = objItem.IPAddress(0)
      End If
  Next
  
  title = "Who Am I?"
  
  message =   "Domain: " &amp; vbTab &amp; vbTab &amp; WshNetwork.UserDomain &amp; VbCrlf &amp; _
              "User Name: " &amp; vbTab &amp; UCase(WshNetwork.UserName) &amp; VbCrlf &amp; _
              "Computer Name: " &amp; vbTab &amp; WshNetwork.ComputerName &amp; VbCrlf &amp; _
              "IP Address1: " &amp; vbTab &amp; strIP 
  
  Msgbox message, , title
  </code></pre>
  
  <hr>