BgInfo IP Address

the following vbs script show the correct ip address and other LAN IPs of 0.0.0.0

how do i remove the ip address with 0.0.0.0

computer = "."
Set wmiService = GetObject("winmgmts:\\" & computer & "\root\CIMV2")
Set items = wmiService.ExecQuery( _
    "SELECT * FROM Win32_NetworkAdapterConfiguration where ipenabled =True",,48)
For Each item in items
    If not isNull(item.IPAddress) Then
        Echo item.IPAddress(0)
    End If
Next

41 01Asked:
Who is Participating?
 
Gerwin Jansen, EE MVEConnect With a Mentor Topic Advisor Commented:
How about this:

Script: testip.vbs
computer = "."
Set wmiService = GetObject("winmgmts:\\" & computer & "\root\CIMV2")
Set items = wmiService.ExecQuery( _
    "SELECT * FROM Win32_NetworkAdapterConfiguration where ipenabled =True",,48)
For Each item in items
    If not isNull(item.IPAddress) and item.IPAddress(0) <> "0.0.0.0" Then
        wscript.Echo item.IPAddress(0)
    End If
Next

Open in new window

Note that I changed the echo line a bit (adding wscript.), I tested like this:

cscript /nologo <testip.vbs>

Open in new window

0
 
41 01Author Commented:
once i changed line 7 back to Echo item.IPAddress(0) it worked with BgInfo

thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.