Learn about Windows PowerShell
Summary: In Beginner Event 5, you are required to provide the source and number of errors from the application log.
About this event
Date of Event
4/6/2012 12:01 AM
4/13/2012 12:01 AM
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.
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 firstname.lastname@example.org, 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
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?
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?
@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.