Read EventLog

NavStudent
Member Posts: 399
Hello
I'm running an executable from navision that write messages in event log. I would like to use a standard automation to query theh eventlog for the message. Can someone point me to the right direction?
The com has to be standard so that I don't have to register it on every box.
Thank you.
I'm running an executable from navision that write messages in event log. I would like to use a standard automation to query theh eventlog for the message. Can someone point me to the right direction?
The com has to be standard so that I don't have to register it on every box.
Thank you.
my 2 cents
0
Comments
-
Hello.
Today is your lucky Day.
Here is an example on how to do it. It uses windows host scrip.//look/query at event for the error. WindowShell.CurrentDirectory(ENVIRON('windir') + '\system32\'); txtCommand := 'cscript eventquery.vbs /L Application /FI "Type eq Error" /V /r 1 /FO "LIST"'; WSHExec := WindowShell.Exec(txtCommand); WSHTextStream := WSHExec.StdOut; //read till 15th line for error I := 0; WHILE (NOT WSHTextStream.AtEndOfStream) AND (I < 15) DO BEGIN txtMsg := WSHTextStream.ReadLine(); I += 1; END; ERROR(txtMsg);
WindowShell is of type 'Windows Script Host Object Model'.WshShell
WSHExec is of type 'Windows Script Host Object Model'.WshExec
WSHTextStream is of type 'Windows Script Host Object Model'.TextStream
You can find more info on this automation in the following link
You can find more help http://www.mibuso.com/forum/viewtopic.php?t=12417&highlight=
as far as eventquery.vbs is concerned and parameters that you can pass to it. you can look in the following link.
http://technet.microsoft.com/en-us/library/bb490900.aspx
the code above you can run from cmd prompt and you'll see the output.
Navigate to c:\windows\system32\
then paste this code
cscript eventquery.vbs /L Application /FI "Type eq Error" /V /r 1 /FO "LIST"
and run it'll you see the error.
Good luck.0 -
[Topic moved from Navision forum to Navision Tips & Tricks forum]Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
wow great solution. Thank you for the solution. =D>my 2 cents0
-
You are welcome.
It looks like this has been moved to tips and tricks.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions