2012 Scripting Games Beginner Event 9: Search the Event Log

Doctor Scripto

Dr Scripto

 2012 Scripting Games badge

Summary: In Beginner Event 9, you are required to search the event log for specific entries.

About this event

Division

Beginner

Date of Event

4/12/2012 12:01 AM

Due Date

4/19/2012 12:01 AM

Event scenario

You are trying to troubleshoot shutdown issues on your laptop. It appears to hang for few seconds before it begins the shutdown process. You were looking through the application event log, and you noticed an event log entry that states that the BTTray.exe application attempted to veto the shutdown (how rude). A sample event log entry is shown in the image that follows.

Image of event log

You decide to search the application log for other event log entries from this source to determine how often this particular application is attempting to veto the shutdown, and to see if there are other applications doing the same thing. You write a quick one-line Windows PowerShell command that displays the date of the occurrence and the application name. An acceptable output is shown in the image that follows (the column headings are hidden because part of the problem is finding the properties to display).

Image of command output

Design points

  • Your command should be as efficient as possible; therefore, you want to limit the entries that are returned from the event log to only those that match the particular scenario. For hints on the filter to use, study the event log entry (the first image).
  • Keep in mind that what appears in a graphical tool is not always what you need to use in your filter.
  • Be careful with the number of entries returned from the application log—make your filter as efficient as possible. You will lose points for inefficient queries.
  • Because you are troubleshooting your computer, this is not a long involved script, but a “one liner.” Do not get carried away writing a complex script—complexity will cost you points.

2012 Scripting Games links

2012 Scripting Games: All Links on One Page

I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at scripter@microsoft.com, or post your questions on the Official Scripting Guys Forum. Good luck as you compete in this year’s Scripting Games. We wish you well.

Ed Wilson, Microsoft Scripting Guy 

0 comments

Comments are closed.