how can i check for an empty collection?
- From: "Mole Man" <k@xxxxx>
- Date: Fri, 27 Apr 2007 14:53:24 -0400
i want to check the event log for a specific event id. chances are it wont exist. if it does NOT exist i need to echo "not found" if it does exist i need to echo the date property of the event, but only for the first one found, then i can exit.
i cant for the life of me figure this out. i though maybe colEvents.EOF but that doesnt exist.
intEventCode = 170456
strLog = "Application"
strComputer = "xpvirtual01"
set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
set colEvents = objWMI.ExecQuery("Select * from Win32_NTLogEvent Where Logfile = '" & strLog & "' and EventCode = " & intEventCode)
if a single event 170456 was found
echo event.date
Else
echo no events found
end if
i know ill probably need a for each loop, or is there a way to only return 1 event from the query? like a SELECT TOP 1 or something?
thanks
.
- Follow-Ups:
- Re: how can i check for an empty collection?
- From: Mole Man
- Re: how can i check for an empty collection?
- Prev by Date: Re: Back Up Log Event
- Next by Date: Re: Triming Text files
- Previous by thread: Re: English equivenent of VBS Factory
- Next by thread: Re: how can i check for an empty collection?
- Index(es):
Relevant Pages
|