Do not crash if an interface does not have an IP address.

This commit is contained in:
Ramon Novoa 2017-04-11 18:10:20 +02:00
parent fc5635381a
commit a2e42134f0
1 changed files with 2 additions and 1 deletions

View File

@ -40,7 +40,8 @@ If (NOT flag) Then
set ifaces_cfg = objWMIService.ExecQuery("Select ipaddress from Win32_NetworkAdapterConfiguration Where Caption='" & iface.caption & "'")
Wscript.StdOut.Write "<data><![CDATA[" & iface.ProductName & ";" & iface.MACAddress & ";"
for each iface_cfg in ifaces_cfg
if ( iface_cfg.IPAddress(0) <> "" ) then
On Error Resume Next
if (iface_cfg.IPAddress(0) <> "" ) then
Wscript.StdOut.Write trim(iface_cfg.IPAddress(0))
end if
next