Re: Fetching 2 NIC values only

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



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: 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)
  • Re: Fetching 2 NIC values only
    ... for each blah blah ... Or - count the values you want and exit when you have as many as you need. ... >>> cards on the machine, so my goal is to fetch the the first and second ... >> torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway ...
    (microsoft.public.win32.programmer.wmi)
  • Re: Exit Button
    ... > I have an application that display users invoice. ... > On every page i have an "Exit button". ... populate the form controls ... set the value in Session to false. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: IF field with a formula
    ... It does not have to be in a formfield, but for Text66, Text67 and Text68 you ... display nothing if Text67 is blank or 0. ... this formula (all have calculate on exit selected). ...
    (microsoft.public.word.tables)
  • 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)