Microsoft Scripting Guy Explains Logic Behind Scripting Games


Summary: Microsoft Scripting Guy, Ed Wilson, explains the logic behind the 2011 Windows PowerShell Scripting Games.

Weekend Scripter

Microsoft Scripting Guy, Ed Wilson, is here. Today, I begin the wrap up for the 2011 Scripting Games, and I hope you will enjoy the wrap up articles I rounded up. The guest commentators are stellar.

I thought I would lead off the wrap up, by explaining a bit about my philosophy surrounding the 2011 Scripting Games. With each iteration of the Scripting Games, I have changed something, tried to improve things, and experimented with other things.

In the first games I did three years ago, I got rid of grading altogether. I wanted to emphasize the learning process, and I felt that grading was counter to that. In addition, being only one scripting person (instead of the team of six they used to have), I could not possibly grade thousands of scripts via email. I decided to partner with the community, and I reached out to Joel Bennett who is the Microsoft PowerShell MVP who runs PoshCode. I wanted to have all of the scripts available to everyone, and not have them collect and linger in an email folder like last year’s holiday wrapping paper.

The community complained about no grades, and no leaderboard, so I introduced them back into the next version, but I introduced the concept of using MVPs and others as judges, to spread out the task of grading. It worked well. I also published scoring guidelines to attempt to provide consistent grades, with room for discretion by the judges. It worked pretty well, but people wanted comments.

This year I solicited and received feedback on the scoring guidelines and published them ahead of the games, and we introduced the ability for judges to leave comments. There are still complaints on grades—and it is impossible for all of the judges to grade and to comment on all of the scripts. The changes I will introduce for the 2012 Scripting Games are yet determined. But I have already begun in-depth discussions with several Microsoft PowerShell MVPs, and I have heard some really exciting proposals. Two people I had discussions with are Boe Prox and Glenn Sizemore (seen in the following picture with me at the Windows PowerShell Deep Dive). Glenn and Boe were the top two winners from the 2010 Scripting Games.


The main point of the Scripting Games is about learning Windows PowerShell. The grades are just fun to spur a bit of extra effort, and all of that. Yet, people take it very serious. I have seen comments about people taking vacation to compete in the games, people spending six or more hours on ONE script. They want to be rewarded—and a decent grade and some eloquent comments are the immediate tangibles they seek.

Some judges seemed to hand out a whole lot of 1s. In fact, this created a huge uproar among the participants, and many people wanted to quit—a few actually did. According to the guidelines, a script that does not work should get a one, but a script that does work and meets the minimum requirements receives a two. The remaining three points are discretionary! In many cases, I listed “optional features” that one could put into a script. These optional features were not the only way to gain extra points, but in reality, they were things I devised to encourage people to see other ways of writing the code or extending the script. I also wanted to, in most cases, point a way for a beginner to receive a five by following a specific path.

For the advanced events, I was not always as prescriptive. Instead of always listing many different ways to extend a script, I preferred to allow more points for “style.” I believe some judges were subtracting points for things they felt were a particularly bad practice. Therefore, a script that actually worked might receive a one. Although this approach to grading may have caused some scripters a bit of discomfort, the scores did not generally cause much of a shift in the overall standing of the games because everyone was graded in the same fashion.

In some cases, I was forced to give a script a one because it did not work as submitted. The script probably did work on the scripter’s system, but due to hard-coded paths, computer names, domain names, and other things that were left into the code, the script did not actually work, and according to the guidelines, it received a one. In such situations, I always tried to leave a comment explaining that the script did not work as published.

In this year’s games, as in last year’s games, I wanted to emphasize certain themes. These things are fundamental to working with Windows PowerShell. I also wanted to indicate new features in Windows PowerShell. In addition, with this year being the first Scripting Games to have no VBScript category, I wanted to use the chance to encourage things that could not be accomplished with VBScript.

Some, but not all of the themes I emphasized this year are listed here:

1. Returning objects from functions

2. Use of comment-based Help

3. Creation of advanced functions

4. Error handling

5. Handling default conditions

6. Checking for dependencies

7. Checking for rights

8. Use of default values for parameters

9. Parameter validation

10. Use of regular expressions

11. Working with the Internet

12. Working with graphical elements in scripts and creation of forms

13. Deciding when to write a script and when to write a “1 liner”

14. Using Get-Help and Get-Member to examine available properties and methods

15. Using MSDN to find scriptable objects

16. Formatting output

As with last year’s Scripting Games, I may have over emphasized one aspect of the games over other aspects of the games. This takes constant tweaking, and I will modify the themes I emphasize next year.

The judges are all volunteers (including myself); and like me, they put in many extra hours to make the games happen. Some of the judges spent dozens of hours grading scripts. Many of the judges spent an entire holiday weekend grading scripts. It had to be done to get every script graded twice (my minimum goal) prior to publication of the final leaderboard.

Let me repeat, I was not alone in this effort. All day on the last day of grading, I saw emails from the different judges as we kept hammering away at the pile of scripts. One judge even wrote a script that listed each script, and the number of times it had been graded. We must have run that script several hundred times that day as we burrowed our way through the seemingly endless pile of submissions.

By the way, the success of the 2011 Scripting Games was beyond my expectations. With the elimination of the VBScript category, and in limiting participation by contestants to either the beginner or the advanced category, I was expecting a reduction in the number of scripts by as much as 45%. In reality, the number of Windows PowerShell scripts submitted increased by nearly 60%.

As for the emphasis on functions…that was a theme this year, and I think the misconceptions uncovered in MANY of the scripts, and the commentary by the judges and others, will be a great learning opportunity. Obviously, there are many ways of reusing code—from Copy/Paste to dot sourcing to incorporation in modules. In fact, not every function in a module needs to be an advanced function—but that is another story.

As much fun as the Scripting Games are, they certainly would not generate quite as much attention if I did not have any prizes to give away. In fact, the prizes are one of the things I really enjoy—not because I get the prizes, but because I get to give them away. This year, I succeeded beyond my wildest imagination and I was able to round up a huge collection of prizes. Microsoft MVP, Jeffery Hicks, summed it up succinctly when he made a tweet that called the prizes “serious swag.”

The Scripting Wife and I were lucky to meet up with many of the 2011 Scripting Games sponsors at the Windows PowerShell Deep Dive in Las Vegas. In the following picture, you will see Teresa Wilson (aka “The Scripting Wife”), James Brundage (Start-Automating), David Corrales (Sapien), Richard Giles (Idera), Kirk Munro (Quest), and Ed Wilson (Microsoft Scripting Guy). Unfortunately I was not able to include representatives from our remaining sponsors in the photo. The sponsors not represented are TechEd, TechNet and O’Reilly.


I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at, or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, peace.

Ed Wilson, Microsoft Scripting Guy



No Comments.