2012 Scripting Games Advanced Event 7: Search Windows Logs

Dr Scripto

 2012 Scripting Games badge

Summary: In Advanced Event 7, you are required to search all Windows logs for the most recent event.

About this event



Date of Event

4/10/2012 12:01 AM

Due Date

4/17/2012 12:01 AM 

Event scenario

You are troubleshooting a problem with your Windows 7 laptop, and you hope to find some clues to the recent performance issues by examining recent entries from various Windows logs. You have recently become aware that there are nearly 500 logs available in a standard Windows 7 installation, but you do not feel like manually searching through all of the logs by using the Event Viewer utility. You decide to use Windows PowerShell to come to the rescue. You want to write a command that will display the most recent one-event log entry from each event log and troubleshooting log that is enabled and has at least one entry in it. Crucial information for this process includes the log name, time of the event, the event ID, and the event message. An acceptable output is shown in the image that follows.

Image of command output

Design points

  • Your code should not display any errors.
  • Your code should query hidden logs if they are enabled and they contain at least one entry.
  • You should display only the most recent entry from each log.
  • The event log entries should be sorted so that the most recent entry appears first.
  • You must display the following required properties: time of the event, the name of the log, number of the event ID, and the event details.

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 


Comments are closed. Login to edit/delete your existing comments