From: David Doumani on
Ok, I finally got the IP addresses for a machine to list out via the
following code...

Next

'IP Address
Wscript.Echo " "
Wscript.Echo " "
Wscript.Echo " IP Addresses "
Wscript.Echo " "
Wscript.Echo " "
Set IPConfigSet = objWMIService.ExecQuery("Select IPAddress from
Win32_NetworkAdapterConfiguration ")
For Each IPConfig in IPConfigSet
If Not IsNull(IPConfig.IPAddress) Then
For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
WScript.Echo " IP ADDRESS: " & IPConfig.IPAddress(i)
Next
End If
Next


I would now like to get the MAC Addres and I have tried selecing * from the
WIn32_NetworkAdapterConfig and listing the mac's but I get all the macs for
all the nics, even if they have no IP associated to them... I would like my
output to be IPADDRESS: 0.0.0.0. MAC ADDRESS: xxxxxxxxxxx

Any suggestions on how to change the above code to reflect that?


From: Ato Bisda on
Just add MACAddress in your WQL and Wscript.echo as in the following:

Set IPConfigSet = objWMIService.ExecQuery("Select IPAddress, MACAddress from
Win32_NetworkAdapterConfiguration ")
For Each IPConfig in IPConfigSet
If Not IsNull(IPConfig.IPAddress) Then
For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
WScript.Echo " IP ADDRESS: " & IPConfig.IPAddress(i), "MAC
ADDRESS:" IPConfig.MACAddress
Next
End If
Next

"David Doumani" <ddoumani(a)doumaniweb.com> wrote in message
news:e6DwXJ$NFHA.1396(a)TK2MSFTNGP10.phx.gbl...

> Ok, I finally got the IP addresses for a machine to list out via the
> following code...
>
> Next
>
> 'IP Address
> Wscript.Echo " "
> Wscript.Echo " "
> Wscript.Echo " IP Addresses "
> Wscript.Echo " "
> Wscript.Echo " "
> Set IPConfigSet = objWMIService.ExecQuery("Select IPAddress from
> Win32_NetworkAdapterConfiguration ")
> For Each IPConfig in IPConfigSet
> If Not IsNull(IPConfig.IPAddress) Then
> For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
> WScript.Echo " IP ADDRESS: " & IPConfig.IPAddress(i)
> Next
> End If
> Next
>
>
> I would now like to get the MAC Addres and I have tried selecing * from
the
> WIn32_NetworkAdapterConfig and listing the mac's but I get all the macs
for
> all the nics, even if they have no IP associated to them... I would like
my
> output to be IPADDRESS: 0.0.0.0. MAC ADDRESS: xxxxxxxxxxx
>
> Any suggestions on how to change the above code to reflect that?
>
>