List IP Addresses (VBScript)

AddThis Social Bookmark Button

This script displays a list of all IP addresses assigned to the current machine.

Dim IPstring

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set IPConfigSet = objWMIService.ExecQuery _
    ("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE")
IPstring = ""
For Each IPConfig in IPConfigSet
    If Not IsNull(IPConfig.IPAddress) Then
        For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
            IF not left(IPConfig.IPAddress(i),7) = "0.0.0.0" then
  IPstring = IPstring & IPConfig.IPAddress(i) & vbCrLF
     end if
        Next
    End If
Next

Msgbox IPstring,64,"IP Addresses"

Only members can add comments. Becoming a member is free. See the Members section for more information.