Sunday, April 08, 2012

PowerShell Scripting Games–Halfway Complete!

If you are a PowerShell Junkie, you know that the PowerShell Scripting Games began last Monday, and the first five events, in each category, are now posted and are being judged. If you are not a PowerShell junkie, the PowerShell Scripting Games is an annual competition amongst beginner and expert scripters to show off their scripting skills (or to learn more!). I described this in my blog last week ( For a more light-hearted introduction, see Sean’s We Will Script It:


We Will Script IT!

The Scripting Games are a time for YOU to both show off your skills, and to lean more. For the judges, it’s turned into quite a lot of work, and a learning opportunity too!

The number of entries, so far, way exceeds my expectations. As of today, here is the count of entries:


If you are good at counting, or can use PowerShell to do the maths – this is tallies to just under 1500 scripts entered so far – and we’re only half way through the overall event. WOW!  I certainly did not expect anywhere near so many entries!!! This just goes to show the momentum and traction that PowerShell is getting.  But it’s sure ended up being a lot of work for the judges – having to review every script and mark it. I had hoped that this year, I’d be able to rate every script, but so far, I’m way behind – I’ve rated probably not much more than 500 so far, and given my real life job, may get further behind as the week goes on! What a really nice problem to have.  I may not end up rating ALL the scripts, but I’ll do my best.

In judging the entries so far, there are several things I’ve noticed:

  1. Some folks can’t read very well or type well. Sad smile There have been far too many scripts entered for the wrong event - if you are entering Beginner Event 1, then please don’t submit the script for Advanced Event 1 or any other event! Also, some folks are not reading the specific details that the script is meant to deal with. While some of the solutions are great, they are not ones that meet the criteria of the event(s).
  2. Handling of Boolean values is not well understood. If you have a Boolean value in PowerShell (eg $Foo), then checking true/false in an If statement should look like this:

       If ($Foo) { <action if true>} else {<action if false>}

    and NOT this:
  3.     If ($Foo – eq “true”) { <action if true>} else {<action if false>}

    Strictly speaking, testing $foo against ‘True’, $true (and $false) works, but the explicit test is unnecessary. And if you are testing against a false value, $foo –eq “false” returns false, NOT TRUE!  I intend to cover boolean values more in the upcoming PowerCamp!

  4. Live vs Static Objects – some objects, when created, are filled with property values that never change (until you refresh the objects). Other objects do update some properties but this is not universal. The System.Diagnostics.Process class is one that a) does some automatic refreshing of property values and b) has a .Refresh() method that refreshes the value. Calling .Refresh is a little faster than creating the whole object. And hands up – I did not know about the .Refresh() method  prior to this year’s competition!
  5. Comment, comment, comment. I see lots of script without any comments, either in the script or in the comments on the solution. If you make a mistake with syntax, the comments might save you a point!
  6. There are a lot of new folks out there who have got the message (PowerShell is the future) and are going great guns to prove their skills. Thanks for your time and effort and even though the scores may not show it – you’re all winners!!

And while thinking about it – see Ed Wilson’s comments on the Games so far at:

So far, this has been a pretty cool competition, and it’s taught me a few things already. If you have not yet joined in, there’s always time to do a few entries. And remember, it’s taking part that counts, not whether you win or lose – everyone’s a winner here!!

And finally – if you are looking at the Events, wondering a) how to solve them and b) feeling like you SHOULD know(!!), and you live in the UK, consider coming along to the PowerShell PowerCamp weekend – we’ll be covering some if not all of the event scenarios during the weekend so who knows, attendance at PowerCamp could mean you are next year’s winner.

No comments: