2012 Scripting Games Beginner Event 5: Provide a Source and Errors

2012 Scripting Games Beginner Event 5: Provide a Source and Errors

  • Comments 18
  • Likes

 2012 Scripting Games badge

Summary: In Beginner Event 5, you are required to provide the source and number of errors from the application log.

 About this event

Division

Beginner

Date of Event

4/6/2012 12:01 AM

Due Date

4/13/2012 12:01 AM

Event scenario

You are a junior server admin on a newly formed team at a medium-sized enterprise company. Your manager is attempting to gain an understanding of which applications are causing problems on your servers. He therefore tasks you to produce a report from each server. The report should list the source and the number of errors from the application log on each server. An appropriate output is shown in the following image.

Image of command output

Design points

  • Your solution should be capable of running against a remote machine, but you do not need to do that for this scenario.
  • You do not need to check for admin rights. Assume that you will have permissions to query the application log on the computer.
  • You should use standard Windows PowerShell cmdlets.
  • Your solution does not need to be long, involved, or complicated. It should be simple and straightforward.
  • You do not need to write to a text file, but your solution should be easily redirectable to a file when needed.
  • You do not need to add comment-based Help.
  • Extra points for sorting the output so that the source with the greatest number of errors appears on the top of the list.

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

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • This looks really complicated to start off but once you actually start reading into the cmdlet it's fairly straight forward.  Feeling very confident about this one, hopefully my first 4 star script!

  • Are you doing a one liner or a full blown script?

  • Remind me again what you mean by "comment-based Help". Does that just mean that we don't need to include comments in the script?

  • Hi Ed,

    a lot of questions are on my mind for this event!

    It looks pretty simple on first sight ...

    Well: "you do not need to ..." --- does this say: "But if you do, you'll get extra points?" :-)

    "...query the application log ..." --- does this mean: query ONLY the application log? ... or all classic logs ? or ...

    "... not need to be long, involved, or complicated ..." --- does this say: "You may use aliases this time"?

    -> this helps, at least regarding shortness :-))

    At least you didn't mention "error handling" ... should we add some anyway?

    Klaus.

  • @Mr Killian yes. This one is not too horribly complicated.

  • I agree with Mr Killian, it actually took a lot less time to figure this one out than I thought it would.  

    @K-Schulte, I think they have mentioned previously that aliases are OK in one-liners, but not OK in scripts.  Also this event says that your code should be simple and straightforward--to me that means don't add a bunch of fluff, just make it do what is requested.

  • @Marc W this scenario can be solved using a one-linner. YOu should not have to write a long complicated script.

  • @Patches_McMatt comment based help take a look at these Hey Scripting Guy blog articles blogs.technet.com/.../searchresults.aspx

  • @K_Schulte No you will not get extra points for the opposite of "you do not need to" because this event already has four specific items that you SHOULD do. Each of these items is 1 point, and you always get 1 point for submitting, so there is the five points. This event can be solved with a one-linner, in which aliases would be acceptible. I stated that you can assume you have rights, so you do NOT need to check for rights. You COULD however, use a cmdlet to ensure your remote comptuer is reachable, prior to doing the query for the errors if you wish. That would be a nice extra touch, but do not ignore the four YOU SHOULD DO ... design points.

  • If I submit a script with an error.  EG: It runs, but produces incorrect results, how do I delete it and resubmit?

  • @Daveyk per the FAQ blogs.technet.com/.../faq-for-the-powershell-2012-scripting-games.aspx You cannot change your script once it is submitted. Sorry. This is one reason you have 7 days for each script, to give you time to work through it before you post it.

  • In prior events, it was stated which platforms were being used.  Since that is not present here (that I see) does the command need to work in an XP/2003 environment, or can we assume Vista/7/2008?

  • A remark from a beginner... I've got 2 points on my script for this event. I don't complain about the score, I'm in this to learn.. But what really would be great is a comment from the judges when the score is that low.. If you don't get to know what you do wrong, it is difficult to learn.. With that said, I do realise that the judges have a lot to do..

  • @Rumart two points means that the script meets the basic requirements of the scenario. 1 point means that it does not meet the requirements. Each of the additional design points either add or take away from a specific score. The judges are really struggling to keep up with the number of scripts -- we have more than twice the number of submissions this year as last. There are many places where you can find out about the judges coments- for exqample some of my blog posts. Next week, there will be expert commentaries on the scenarios. In addition, many of the judges are posting things they are seeing on their blogs. We will be having a list of Judges blogs soon.

  • @Ncoppersmith the requirements for this exercise can be met on all platforms that run Windows PowerShell 2 or grater.