Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Scripting > RE: How to query archived event log

Reply
Thread Tools Display Modes

RE: How to query archived event log

 
 
urkec
Guest
Posts: n/a

 
      03-20-2009
"" wrote:

> I have written a vbs script to query existing application event log.
> The main query would be "Select * from Win32_NTLogEvent Where Logfile
> = 'Application' ....
>
> How do I query an existing archived event log?
>
> Thanks.
>


One way to read archived .evt files that I know of is to use Log Parser.
Unfortunately, you first need to download (from
http://www.microsoft.com/downloads/d...displaylang=en)
and install it, so this can be a problem if you don't have enough privileges
or don't want to install it.

If you decide to use it, there is a .chm help file that comes with the
installation, and also some samples in the installation directory. You can
use Log Parser from the Command Prompt, but here is a small VBScript sample:

strQuery = "Select EventId, Message From C:\test.evt"

Set objLogQuery = CreateObject("MSUtil.LogQuery")
Set objRecordset = objLogQuery.Execute(strQuery)

Do Until objRecordset.atEnd
Set objRecord = objRecordset.GetRecord()
WScript.Echo objRecord.GetValue(0), _
Left(objRecord.GetValue(1),75)
objRecordset.moveNext
Loop

--
urkec

My blog:
http://theadminblog.blogspot.com/

My CodeProject articles:
http://www.codeproject.com/script/Ar...x?amid=4210975

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Event ID 10 — Event Filter Query Functionality RandyERaymond Windows Vista Hardware 0 02-23-2009 04:15 PM
Event ID 10- Event Filter Query Functionality 2Lauraroberts Windows Vista Performance 1 11-24-2008 05:22 AM
Event Log query James Scripting 3 08-10-2006 03:42 PM
Open archived event log (.evt) via WMI mn_ms_user Scripting 0 09-02-2005 12:55 AM
Re: Query Windows Event Log Dino Scripting 0 09-17-2003 04:12 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59