The 2011 Scripting Games Beginner Event 3: Use PowerShell to Report Event Log and ETL Log Details

The 2011 Scripting Games Beginner Event 3: Use PowerShell to Report Event Log and ETL Log Details

  • Comments 6
  • Likes

2011 Scripting Games badge

Summary: Beginner Event 3 of the 2011 Scripting Games uses Windows PowerShell to report details about classic event and ETL logs.

About this event

Division

Beginner

Date of Event

4/6/2011 12:01 AM

Due Date

4/13/2011 12:01 AM

Event scenario

You are in charge of server monitoring at a medium-sized company that consists of three geographically dispersed sites and 50 servers. The servers are running a combination of Windows Server 2008 R2 and Windows Server 2008. You want to produce a report of all classic event logs and the ETL diagnostic logs that also exist. Your report should only list logs that are enabled. The list should be sorted by the last time the log was written to, and the most recent dates should be on top of the list. In addition, the report should state the size of the log, and whether or not it is a classic log. A sample output is shown in the following image.

Image of command output

Design points

  • Your script does not need to run against a remote machine for the purposes of this scenario, but if it does you will score more points.
  • You only need to sort the list by the last time the log was written to, but if you also sort by log size and whether it is a classic log, you will score more points.
  • Your script only needs to display output to the console, but you can gain additional points for improvement on the output of your report.

2011 Scripting Games links

2011 Scripting Games: All Links on One Page

Submit your scripts on PoshCode

Support our Sponsors!

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

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • <p>Woo hoo! finally a script I was able to finish in one hour! The first one took me about 6hrs (for one crummy star :-]), the 2nd one about 4 hrs. &nbsp;Time to enjoy the fruit of my improvement (extra sleep!). Good luck everyone, good nite!</p>

  • <p>My first one went from a 2 to 1.5, so you&#39;re not alone in that boat. &nbsp;I&#39;m thinking it was my if statements instead of actual error checking and the lack of a help file. &nbsp;This may help you some. &nbsp;I&#39;m using this in all of them from now on. <a rel="nofollow" target="_new" href="http://kevinpelgrims.wordpress.com/category/powershell/">kevinpelgrims.wordpress.com/.../powershell</a> &nbsp;This also reinforces what I&#39;ve said several times before; IT is one of the few areas that when something is discovered that works, the first thing we do is share. </p>

  • <p>Thanks for the link :-) Originally I was using Powershell 2.0 TFM (i guess in support of one of the sponsors), and PowerShellHelp Community Edition as my main resources. &nbsp;At a judge&#39;s suggestion, I started using Weekend Scripter: 2010 Scripting Games Study Guide and that saved me hours for #2 and #3.</p> <p>Event #1 took me forever because of my own foolish assumptions, because of the wording of the event, I thought that the file version for notepad was meant to mimick the private build; so I went on to figure out how to use regex matching between an input variable and the result of my get, I didn&#39;t realize that there was actual specific private build metadata! But anyway I don&#39;t regret the time spent; under different circumstances I may have skipped the hours of research.</p>

  • <p>Notepad, Powershell for Dummies, and Google. &nbsp;This one was the shortest of all three events so for to do for me, partly because I already knew the techniques and only needed to research a little bit.</p>

  • <p>Im getting murdered on there beginner event. &nbsp; I thought I nailed #3 even had a fancy html report but got a crummy 2 stars (my highest so far) and no comments , arg!</p>

  • <p>You should definately check out the 2011 Study Guide (on the all in one page) because most of the topics I cover in the games are also covered there. Also pay attention to the Scripting Wife articles because they are great beginner resources. Keep in mind that your scores will continue to change even after the games are completely over. This is because we have 30 judges, and all the scores are not due in until April 29, 2011. With an expected several thousand submissions, it can take a long time to rate all the scripts. Not all judges will grade all scripts. Not all judges will leave comments (grading them is the top priority) but some judges are leaving detailed comments (me for instance) but I do not think I will be able to grade all scripts. For example, the last script I graded took me 20 minutes! Multiple that time a couple thousand, and you can see I do not have the time to grade all that many scripts. </p>