Well, I don’t know about where you live, but it is an absolutely perfect day today in Charlotte, North Carolina. I hope you are enjoying the 2012 Scripting Games, and that you are finding them challenging and fun. That is, at least so far, the way I would describe it. The Beginner Event 5 was not too bad. My solution ended up being a one-line command.
There are several keys to understanding this particular event. In fact, it seems that most of the design points are expressed as negatives. But before we get to that, let me tell you that we are dealing with the classic type of event logs. Not just the big three (System, Security, and Application)—but any event log that is created by using the old-fashioned type of technology. This should tell you something about which cmdlet will be easiest to use. If not, use the Get-Command cmdlet and look for something that has a noun that looks like it has to do with event logs. Next, use the Get-Help cmdlet to see if the cmdlet you discovered reads the classic event logs. Now to the details...
1. The design points say the cmdlet should have the ability to run against a remote computer, but that you do not need to do this for the scenario. So as long as the cmdlet supports targeting a remote computer, everything is cool.
2. I do not need to check for admin rights.
3. I do not need to be long, involved, or complicated.
4. I do not need to add comment-based Help.
So what do I have to actually do?
1. I need to use standard Windows PowerShell cmdlets.
2. I need to sort the output so that the largest number of errors appears on the top of the list. (Note that the picture in blog does not do that.)
3. I need to be able to redirect the output to a file. (I do not have to actually do this, but the output SHOULD write to a text file if I do in fact redirect the output. This requirement should tell you specific things about how the script can and can not be written.)
4. I need to write simple, straight forward code.
So at the end of looking at this, we have a list of points that will be subtracted from my script total if anything is missing, or if I do something that I should not do. For each violation, expect to lose one point.
Well, best of luck to you. I am going to go outside to enjoy the beautiful Charlotte weather (before it gets too hot and humid).