I trying to use it to perform a task. Here is an example
Got this from Script-O-Matic. My question involves only pulling certain
records from colItems, I am looking to pull the first record of the query.

****
This is the part that displays the results. For example, this will display
5 records. I only want the first one


For Each objItem In colItems
WScript.Echo "GroupComponent: " & objItem.GroupComponent
WScript.Echo "PartComponent: " & objItem.PartComponent
WScript.Echo
Next


****

Any assistance that you can provide is much appreciated.


Here is the entire code

Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20

arrComputers = Array("FAMILY")
For Each strComputer In arrComputers
WScript.Echo
WScript.Echo "=========================================="
WScript.Echo "Computer: " & strComputer
WScript.Echo "=========================================="

Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM
Win32_GroupInDomain", "WQL", _
wbemFlagReturnImmediately +
wbemFlagForwardOnly)

For Each objItem In colItems
WScript.Echo "GroupComponent: " & objItem.GroupComponent
WScript.Echo "PartComponent: " & objItem.PartComponent
WScript.Echo
Next
Next

Re: Pulling the first record by Peter

Peter
Sun Mar 13 07:59:29 CST 2005

> This is the part that displays the results. For example, this will
display
> 5 records. I only want the first one

For Each objItem In colItems
WScript.Echo "GroupComponent: " & objItem.GroupComponent
WScript.Echo "PartComponent: " & objItem.PartComponent
WScript.Echo
Exit For ' jump out after first record
Next

--
Regards,
Peter Thornqvist