This is a multi-part message in MIME format.

------=_NextPart_000_000A_01C52883.E800CAC0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi,

The following code query the IP address of enabled NIC cards, how do I =
assign the IPConfig.IPAddress(i) to another variable and Echo the output =
later on(not within FOR... EACH... NEXT)?=20

The IPConfig.IPAddress(i) seems like an array, you help is greatly =
appriciated.

Thanks
Frank



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

Set IPConfigSet =3D objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration Where =
IPEnabled=3DTRUE")
=20
For Each IPConfig in IPConfigSet
If Not IsNull(IPConfig.IPAddress) Then=20
For i=3DLBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
WScript.Echo IPConfig.IPAddress(i)
Next
End If
Next


------=_NextPart_000_000A_01C52883.E800CAC0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1491" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>The following code query the IP address =
of enabled=20
NIC cards, how do I assign the IPConfig.IPAddress(i) to another variable =
and=20
Echo the output later on(not within FOR... EACH... NEXT)? </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>The IPConfig.IPAddress(i) seems like an =
array, you=20
help is greatly appriciated.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Frank</DIV>
<DIV><BR></DIV></FONT>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>strComputer =3D "."<BR>Set =
objWMIService =3D=20
GetObject("winmgmts:" _<BR>&nbsp;&nbsp;&nbsp; &amp;=20
"{impersonationLevel=3Dimpersonate}!\\" &amp; strComputer &amp;=20
"\root\cimv2")<BR><BR>Set IPConfigSet =3D objWMIService.ExecQuery=20
_<BR>&nbsp;&nbsp;&nbsp; ("Select * from =
Win32_NetworkAdapterConfiguration Where=20
IPEnabled=3DTRUE")<BR> <BR>For Each IPConfig in =
IPConfigSet<BR>&nbsp;&nbsp;&nbsp;=20
If Not IsNull(IPConfig.IPAddress) Then=20
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; For =
i=3DLBound(IPConfig.IPAddress)=20
to UBound(IPConfig.IPAddress)</FONT></DIV>
<DIV><FONT face=3DArial=20
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;=20
WScript.Echo =
IPConfig.IPAddress(i)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
Next<BR>&nbsp;&nbsp;&nbsp; End If<BR>Next<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;</DIV></FONT></BODY></HTML>

------=_NextPart_000_000A_01C52883.E800CAC0--

Re: assign array to a variable by gabor

gabor
Mon Mar 14 02:49:45 CST 2005

This is a multi-part message in MIME format.

------=_NextPart_000_000E_01C5287B.27AF1040
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

dim var1 'var1 is type variant, so it accepts *any* data type
var1=3Dipconfig.ipaddress
for i=3D0 to ubound(var1)
wscript.echo var1(i)
next
"Frank" <signup0702@sina.com> wrote in message =
news:uT38ZUEKFHA.2920@TK2MSFTNGP10.phx.gbl...
Hi,
=20
The following code query the IP address of enabled NIC cards, how do I =
assign the IPConfig.IPAddress(i) to another variable and Echo the output =
later on(not within FOR... EACH... NEXT)?=20
=20
The IPConfig.IPAddress(i) seems like an array, you help is greatly =
appriciated.
=20
Thanks
Frank


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

Set IPConfigSet =3D objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration Where =
IPEnabled=3DTRUE")

For Each IPConfig in IPConfigSet
If Not IsNull(IPConfig.IPAddress) Then=20
For i=3DLBound(IPConfig.IPAddress) to =
UBound(IPConfig.IPAddress)
WScript.Echo IPConfig.IPAddress(i)
Next
End If
Next

=20

------=_NextPart_000_000E_01C5287B.27AF1040
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2919.6307" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3D"Comic Sans MS" size=3D2>dim var1&nbsp;&nbsp;&nbsp; =
'var1 is type=20
variant, so it accepts *any* data type</FONT></DIV>
<DIV><FONT face=3D"Comic Sans MS" =
size=3D2>var1=3Dipconfig.ipaddress</FONT></DIV>
<DIV><FONT face=3D"Comic Sans MS" size=3D2>for i=3D0 to =
ubound(var1)</FONT></DIV>
<DIV><FONT face=3D"Comic Sans MS" size=3D2>&nbsp;&nbsp;&nbsp; =
wscript.echo=20
var1(i)</FONT></DIV>
<DIV><FONT face=3D"Comic Sans MS" size=3D2>next</FONT></DIV>
<BLOCKQUOTE=20
style=3D"BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: =
0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">
<DIV>"Frank" &lt;<A=20
href=3D"mailto:signup0702@sina.com">signup0702@sina.com</A>&gt; wrote =
in message=20
<A=20
=
href=3D"news:uT38ZUEKFHA.2920@TK2MSFTNGP10.phx.gbl">news:uT38ZUEKFHA.2920=
@TK2MSFTNGP10.phx.gbl</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>Hi,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>The following code query the IP =
address of=20
enabled NIC cards, how do I assign the IPConfig.IPAddress(i) to =
another=20
variable and Echo the output later on(not within FOR... EACH... NEXT)? =

</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>The IPConfig.IPAddress(i) seems like =
an array,=20
you help is greatly appriciated.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Frank</DIV>
<DIV><BR></DIV></FONT>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>strComputer =3D "."<BR>Set =
objWMIService =3D=20
GetObject("winmgmts:" _<BR>&nbsp;&nbsp;&nbsp; &amp;=20
"{impersonationLevel=3Dimpersonate}!\\" &amp; strComputer &amp;=20
"\root\cimv2")<BR><BR>Set IPConfigSet =3D objWMIService.ExecQuery=20
_<BR>&nbsp;&nbsp;&nbsp; ("Select * from =
Win32_NetworkAdapterConfiguration=20
Where IPEnabled=3DTRUE")<BR><BR>For Each IPConfig in=20
IPConfigSet<BR>&nbsp;&nbsp;&nbsp; If Not IsNull(IPConfig.IPAddress) =
Then=20
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; For=20
i=3DLBound(IPConfig.IPAddress) to =
UBound(IPConfig.IPAddress)</FONT></DIV>
<DIV><FONT face=3DArial=20
=
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;=20
WScript.Echo=20
IPConfig.IPAddress(i)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
Next<BR>&nbsp;&nbsp;&nbsp; End If<BR>Next<BR></FONT></DIV>
<DIV><FONT face=3DArial =
size=3D2>&nbsp;</DIV></BLOCKQUOTE></FONT></BODY></HTML>

------=_NextPart_000_000E_01C5287B.27AF1040--