Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - extract the necessary rowdata from log/txt file from query eventqu

Reply
 
Old 05-27-2009   #1 (permalink)
tonycd


 
 

extract the necessary rowdata from log/txt file from query eventqu

I got the output log/txt/csv file from eventquery.vbs. and now I just want to
extract the necesary rowdata from the output file which eventquery syntex
can;t do. The output file from eventquery is very complicated and i want to
make the view more simple. Would you please tell me how. thanks.

My System SpecsSystem Spec
Old 05-27-2009   #2 (permalink)
Pegasus [MVP]


 
 

Re: extract the necessary rowdata from log/txt file from query eventqu


"tonycd" <tonycd@xxxxxx> wrote in message
news:6A21F0DD-45F7-4E5B-A7EF-CE52D5943A47@xxxxxx
Quote:

>I got the output log/txt/csv file from eventquery.vbs. and now I just want
>to
> extract the necesary rowdata from the output file which eventquery syntex
> can;t do. The output file from eventquery is very complicated and i want
> to
> make the view more simple. Would you please tell me how. thanks.
Let's have a look at
a) your eventquery command, and
b) a typical output line you wish to massage, and
c) the output format you wish to achieve.


My System SpecsSystem Spec
Old 05-29-2009   #3 (permalink)
Pegasus [MVP]


 
 

Re: extract the necessary rowdata from log/txt file from query eve


"tonycd" <tonycd@xxxxxx> wrote in message
news:18DFC342-24FE-42C6-B1CF-0A41B6E748C4@xxxxxx
Quote:

> Hi Pegasus
>
> Thanks. Below is the simple for your information. and i just want to
> remove
> some column and remain some information from description column (the
> information why the staff failure to logon). Thanks again.
>
> regards
> Tony
>
Below is some sample code that you could use to massage your output. It is
based on you using the "/fo CSV" switch when running eventquery.vbs. You may
want to massage the "Description" column further in order to enhance
readability.

You could, of course, modify eventquery.vbs itself. This implies that you
familiarise yourself with the way the program is designed.

Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oLog = oFSO.OpenTextFile("d:\Event.txt")
Const Type_ = 0, Event_ = 1, DateTime = 2, Source = 3, Computer = 4
Const Category = 5, User = 6, Description = 7
Const sDelimiter = ""","""

While Not oLog.AtEndOfStream
sLine = Replace(oLog.ReadLine, sDelimiter, "|")
if len(sLine) > 0 then sLine = Left(sLine, Len(sLine) - 1)
aLine = Split(sLine, "|")
If UBound(aLine) < 7 Then
WScript.Echo sLine
Else
WScript.Echo
WScript.Echo "Date: ", aLine(DateTime)
WScript.Echo "Category: ", aLine(Category)
WScript.Echo "User: ", aLine(User)
WScript.Echo "Description", aLine(Description)
End If
Wend
oLog.Close


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
CAN'T EXTRACT ISO FILE Vista General
Extract dll from cab file with VBScript VB Script
Extract sound from avi file Vista music pictures video
Extract a zip file Vista security
extract vista I can extract vista from the iso file but can not ex Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

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