You could do something like this to quickly give you just a count of the
events. This script counts the number of account lockouts.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colLoggedEvents = objWMIService.ExecQuery _
("Select * from Win32_NTLogEvent Where Logfile = 'Security' and " &
"EventCode = '681'")
Wscript.Echo "Account Lockouts: " & colLoggedEvents.Count
----- Original Message -----
From: "Bendall, Paul" <[EMAIL PROTECTED]>
To: "NT 2000 Discussions" <[EMAIL PROTECTED]>
Sent: Thursday, September 04, 2003 4:29 AM
Subject: WMI Query
> Hi all,
>
> I am doing a WMI query to the event log for a specific event. However, how
> can I quickly and easily test whether the query returns anything?
Currently
> I use a count statement on the result, but this takes ages (minutes) to
> return a result. How can I speed this process up or do it another way.
Here
> is my code:
>
> Set wmi = GetObject("winmgmts:\\" & Server.get("rdn") & "\root\CIMV2")
>
> wql = "select * from Win32_NTLogEvent where logfile='Application' and
> eventcode='1221' and sourcename='MSExchangeIS Private'"
>
> Set result = wmi.ExecQuery(wql)
>
> if result.count = 0 then
> do something
> End if
>
> TIA,
>
> Paul
>
>
>
> ----------------------------------------------------------------------
> If you have received this e-mail in error or wish to read our e-mail
> disclaimer statement and monitoring policy, please refer to
> http://www.drkw.com/disc/email/ or contact the sender.
> ----------------------------------------------------------------------
>
>
> ------
> You are subscribed as [EMAIL PROTECTED]
> Web Interface:
http://intm-dl.sparklist.com/cgi-bin/lyris.pl?enter=nt2000&text_mode=&lang=english
> To unsubscribe send a blank email to %%email.unsub%%
>
------
You are subscribed as [EMAIL PROTECTED]
Web Interface:
http://intm-dl.sparklist.com/cgi-bin/lyris.pl?enter=nt2000&text_mode=&lang=english
To unsubscribe send a blank email to [EMAIL PROTECTED]