Re: Fetching 2 NIC values only
- From: "Jim Vierra" <jvierra@xxxxxxx>
- Date: Mon, 23 May 2005 20:00:08 -0400
i = 0
for each blah blah
i = i +1
if i > 2 then Exit For
.....
Or - count the values you want and exit when you have as many as you need.
--
Jim Vierra
"Tory Collum" <ToryCollum@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:0DD8192D-E590-4FD5-8290-AC31965143B4@xxxxxxxxxxxxxxxx
> The Exit For is there because I don't know how to display 2 categories
> only.
> Exit For of course just cuts the display to show the first value. My
> Windows
> 2003 Server has two physical NIC's and that's all I want to display.
> There
> are some other items to that come up if I remove the Exit For, but they
> are
> not useful to me.
>
> I'm just looking for a way to enumerate the first two values only...
>
>
>
> "Torgeir Bakken (MVP)" wrote:
>
>> Tory Collum wrote:
>>
>> > This script returns the first network card, but I actually have two
>> > network
>> > cards on the machine, so my goal is to fetch the the first and second
>> > cards
>> > (which I assume are 0 and 1)-what is the best way I can do that?
>> >
>> > Thank you
>> >
>> > sComputer = "."
>> > sNameSpace = "root/CIMV2"
>> > sClass = "Win32_NetworkAdapterConfiguration"
>> > Set cInstances =
>> > GetObject("winmgmts:{impersonationLevel=impersonate}//" & _
>> > sComputer & "/" & sNameSpace & ":" & sClass).Instances_
>> > For Each oInstance In cInstances
>> > WScript.Echo String(60,"=")
>> > For Each oProperty In oInstance.Properties_
>> > WScript.Echo oProperty.Name
>> > If IsArray(oProperty) Then
>> > For iCount = 0 To UBound(oProperty)
>> > WScript.Echo vbTab & oProperty.Value(iCount)
>> > Next
>> > ElseIf IsNull(oProperty) Then
>> > Wscript.Echo vbTab & "Property not set"
>> > Else
>> > WScript.Echo vbTab & oProperty.Value
>> > End If
>> > Next
>> > Exit For
>> > Next
>> Hi,
>>
>> Remove the "Exit For" line and see if it gives you what you want.
>>
>>
>>
>> --
>> torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
>> Administration scripting examples and an ONLINE version of
>> the 1328 page Scripting Guide:
>> http://www.microsoft.com/technet/scriptcenter/default.mspx
>>
.
- Follow-Ups:
- Re: Fetching 2 NIC values only
- From: Tory Collum
- Re: Fetching 2 NIC values only
- References:
- Fetching 2 NIC values only
- From: Tory Collum
- Re: Fetching 2 NIC values only
- From: Torgeir Bakken \(MVP\)
- Re: Fetching 2 NIC values only
- From: Tory Collum
- Fetching 2 NIC values only
- Prev by Date: How to detect network Loss
- Next by Date: Re: How to detect network Loss
- Previous by thread: Re: Fetching 2 NIC values only
- Next by thread: Re: Fetching 2 NIC values only
- Index(es):
Relevant Pages
|