2012 Scripting Games Beginner Event 7: Display a List of Enabled Logs

Dr Scripto

 2012 Scripting Games badge

Summary: In Beginner Event 7, you are required to display a list of all enabled logs on the computer that contain at least one entry.


About this event



Date of Event

4/10/2012 12:01 AM

Due Date

4/17/2012 12:01 AM


Event scenario

On a Windows 7 computer, nearly 500 logs provide auditing and troubleshooting capabilities. Many of these logs do not record any information unless an administrator enables them. You were recently discussing this information with your boss, and he asked a rather logical question:

“What logs actively record information on a Windows 7 computer at any given time?”

You were, of course, somewhat taken aback, and headed off to TechNet to find the answer. After about fifteen minutes of searching and clicking around, you were no closer to the answer than when you began. Your boss came over to you and suggested that you use Windows PowerShell to find the answer. The following image represents an acceptable type of output.

Image of command output

Design points

  • Your code should not display any errors when run.
  • Your code should display all logs that have entries in them.
  • Your code should display only logs that are enabled.
  • Your code should display any enabled hidden logs that contain entries in them.
  • You should display the complete log name, and the number of entries in the log.
  • The number of entries in the logs should be displayed in descending order (the log with the most entries in it should appear on the first line of the output).
  • You do not need to display a total count of the number of enabled logs that have entries.
  • The requirements for this scenario can be met with a “one liner” (a one line logical command). Depending on the width of your Windows PowerShell console and the screen resolution, it may occupy more than one physical line).
  • You do not need to write comment-based Help or accept command-line parameters (or anything like this). Your goal is simply to provide a bit of information to your boss—a “one liner” is perfectly acceptable.

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