Re: Fetching 2 NIC values only

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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
>>


.



Relevant Pages

  • Re: Adding a Key without overwriting what is already there
    ... registry value instead of creating yet another registry entry): ... On Error Goto 0 ... Exit For ' finished, exit the loop ... -- torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ...
    (microsoft.public.win2000.registry)
  • Re: wbemtest and network adapter events
    ... > events coming through when I unplug my cable (the system tray sees ... ' enable the line below if you want to exit after the first event. ... -- torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ...
    (microsoft.public.win32.programmer.wmi)
  • Using open and pipe and regex - need some guidance please
    ... Am very new to Perl and has mostly done UNIX shell scripting. ... grep for things that I need to check, for example, ps -ef | grep ... close CAT; ...
    (perl.beginners)
  • Re: Fetching 2 NIC values only
    ... The Exit For is there because I don't know how to display 2 categories only. ... >> cards on the machine, so my goal is to fetch the the first and second cards ... > torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway ...
    (microsoft.public.win32.programmer.wmi)
  • Re: IE Toolbar Setting
    ... > unwanted toolbar line disappear by clicking on the display ... But when I exit IE and them come back for a new ... The Parasite Fight Quick Fix Protocol ... -- torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ...
    (microsoft.public.win2000.general)