Scripting Games

Scripting Games
Glenn Sizemore
Scripting Games

OK i'm impressed: Scripting Games Week 1

Well guys, and gals another year has passed, and the annual scripting games are upon us again.  After a week of reviewing submissions for their technique and style I must say that I am truly impressed!  As a community the average ability seems to be growing by leaps and bounds.  That"™s not to say we"™re all Samurai just yet, but we"™re getting there!
Before I go off and nit-pick I want to congratulate you all on a small mountain of really well written scripts.  Some of the things that the community was preaching 5 years ago are now just standard.  Stuff like comment your code, format for readability, and Parameters.  At this point I"™m convinced those who still aren’t conforming are simply non-conformist and well that"™s a lost cause.  For the rest of us great work and keep it up!
**Where is the Help!
** What I  didn’t  see enough of in the advanced category is help.  Honestly if you"™re going to write a 200 line script fill out the help!  It"™s not that hard and it is THE difference between a good script and a great solution! It"™s also one of the fundamental differences between hacking and tool building, both are focused around automating a given problem set.  The hacker just gets it to work, the tool builder makes it usable by the masses.  If you haven"™t figured it out yet the real money is in tool building, I"™m just sayin!

Don Jones
Scripting Games

Event 2 Opens / Event 1 Winding Down

Event 2 is scheduled to open this evening in The Scripting Games - remember, all times on the Scripting Games Web site are GMT. You will need to adjust for your local time zone.
Voting on Event 1 is scheduled to end on May 7th, so you still have 5 days to earn pointlets and leave comments for your colleagues. As of right now, we have over 330 entries, and an astounding 4,900 votes - an average ratio of more than 14 votes per entry. Folks, that’s seven times more than we’ve been able to provide in the past by just having “expert judges” voting.
Those experts are now being put to better use, providing the learning experience we so much want to deliver. They’re posting in their own blogs (list) as well as here on PowerShell.org, and there’s a lot to read. I’m delighted that we’ve been able to provide so much commentary before Event 2 starts, since that’ll doubtlessly help everyone do better.
The average CrowdScore is 2.551 per entry - obviously there’s everything from 1-point entries to 5-point entries. Folks are being pretty critical, and identifying things they don’t like, as well as things they do. With more than 1800 comments (that’s an average of more than 5 per entry), hopefully competitors are starting to get some take-aways from the community as well.
On Mighty Panel of Celebrity Judges will start awarding first, second, and third place in Event 1 very soon, and that process will take a few days. Keep in mind that their decisions are in no way connected to the community-based CrowdScore. Instead, they’re exploring entries on their own, stating with the ones “favorited” by our expert commentary judges.
Also, I’ve heard some concern about people trying to “cheat” the system by simply dropping in random votes in order to rack up pointlets and win prizes. We’re watching for that - we log IP addresses, vote times, and a lot of other data. We’ll be filtering the votes before awarding prizes, so there’s just no value in cheating. You won’t see that filtering - we’re doing it on an offline copy of the data so that there’s no chance of accidentally deleting anything valuable - but you’ll also be happy to know that, right now, there’s very little in the way of anything suspicious, and nothing that’s been confirmed.
I want to re-emphasize that the CrowdScore activity doesn’t become a true learning experience until after the Games are over, which is when we can start mining that data and divining some crowdsourced best practices and patterns - creating our own community sense of “right and wrong” in PowerShell. I also want to point out that, after the Games, we’ll be posting all entries, and their comments, into easier-to-download archives (I know the Web site doesn’t make copy n paste super-easy; that’s largely an artifact of what we need to do to display things properly; we’re not offering downloads at this time mainly to control server load).
Enjoy Event 2!

Don Jones
Scripting Games

Thoughts on Event 1 – and, frankly, a rant.

There’s been a lot of dismay floating around the community about the state of “community voting” in the Scripting Games. Some folks are voting without leaving comments (we’ve expanded the comment field to 2000 characters, hopefully that’ll help), and some disagreement about scores.
Disagreement is natural. For example, stick a Write-Host in your script and I’m likely to score you lower. You may disagree, but it’s how I feel in many situations… and I’m seeing a distressing amount of it.
Did you know that using [CmdletBinding(SupportsShouldProcess=$True)] doesn’t automatically and universally make the -confirm switch work? You have to do a bit more.
Did you know that if you put $DebugPreference=‘SilentlyContinue’ in your BEGIN{} block, that you disable the built in -Debug switch’s functionality? Yep, seen this one a few times also.
The community is showing a distinct lack of love for scripts that look like VBScript scripts. Does that mean your script is wrong? No - but it means you’re not approaching the problem in a way that the world in general feels is best. It doesn’t mean your script won’t work - but it means it wouldn’t be widely accepted.
If you’re not happy with your score, look at some higher-scoring scripts. See what they’re doing differently. If you can’t figure it out, post in the forums on PowerShell.org (there’s a Scripting Games forum). Provide the permalink to your script, and solicit some feedback from the community. Tweet people and ask them to take a look. You can ask for more feedback, if you want it and aren’t getting enough.
As our judges begin to post their notes, look at what they’re writing. Maybe they didn’t pick your script to write about - but are they writing about things that you also did in your script?
I’m seeing a lot of good scripts. But I’m also seeing some misunderstandings of some core, advanced features, like error handling, use of Verbose output, and so on. Each of those is a star to a half-star off, for me… some of these things, in my opinion, are severe, and I score accordingly. I haven’t seen a perfect, un-improve-able script, yet (I’m not even halfway through, yet). So no 5-stars yet. But I am trying to leave comments, and I know others are, too, so hopefully folks can improve. But be patient - it takes time.
And opinions differ. Let me offer an example:
Write-Verbose (“Script: {0} ended at {1}” -f $MyInvocation.ScriptName, (get-date) )
****Dislike. Not saying it’s wrong at all - and some people will disagree, vehemently, with me. But I find -f strings hard to read.
Write-Verbose “Script $($MyInvocation.ScriptName) ended at $(Get-Date)”
****For me, that’s easier to read. Not any more “right,” but in my company that’s the standard we adopted and that we use. Now, hopefully my opinion is being balanced by others’ opinions. But, if a substantial number of people share my opinion, this code would get a low score, and a community standard practice would emerge - something we can learn from after the Games are complete. Because yes, I’m going to harvest the Games entries and comments long after the Games are over to help keep the conversation and education going.
My point of this is that none of us are as awesome as we think. Others will always have points of disagreement. What’s really exciting here is the opportunity to create a community consensus of what’s best. That won’t come for several weeks, yet… but it will come. There is zero immediate benefit in getting a high score in the Games, and zero immediate detriment to a low score. This is going to seem harsh, but the Games are not about you. They’re about all of us. They’re about us developing a sense of community involvement and standards in an industry that doesn’t supply many of its own. This will happen over time, and with a lot of effort. But it’s worth it.
Let’s continue.
[ValidateScript({(Test-Path $_ -PathType Container)})]
I love that. I never thought to do that, and I love it. I’ve seen a few people do it. Bless them. I learned something!
An aside: There’s this general undercurrent of, “I wish ’expert’ judges were scoring me instead of the great unwashed masses.” Let me point out some practical realities. One, every entry in the Games at this point has at least 4 votes; many have double that. The last event, most had 1, 2 at most. And yes, while ’expert’ judges are allegedly well-qualified to render judgment, I’m not seeing a ton of scores I completely disagree with, yet. A few. Not a ton. And you want to know a dirty secret? How many entries do you think an ’expert’ can look at, in the evening, after working all day (we’re all volunteers), before he just starts getting a little arbitrary and inconsistent? The number is not “infinite.” I know I got a little arbitrary last year before I caught myself and stopped for the night. So… don’t discount the value of your peers’ opinions. If you’re getting a low score and don’t know why, seek out answers. Yes, people should leave comments with their votes. If they don’t, take charge and seek out answers yourself.
I love that I’m seeing so many divergent approaches to a single (admittedly open-ended) problem. Frankly, the value here is in browsing others’ approaches and picking up some tips from them. Or just seeing something different. You shouldn’t care about your score. You should care about what other people are doing, and about why you think their way might be better, worse, or just different. Make a learning opportunity. Don’t wait for someone to come to you with a free, written analysis of your code. Analyze other people’s entries and judge yourself against their work.
I’ve seen this a few times:

Don Jones
Scripting Games

Scripting Games Voting Continues!

As of right now, we’ve got almost 1900 votes on entries in the Scripting Games. Remember that each vote is a “pointlet” (see the PowerShell tie-in we did there?), which is basically a raffle ticket in our prize lottery.
But… there’s a secret about the lottery. It’s weighted based on how many entries you’ve voted on.
The algorithm is a bit complex, but for example, if you’ve voted on 90% of the available entries, you’re something like 30% more likely to win a prize. Vote on 50%, and you’re about 12% more likely to win… and so on. It’s a bit logarithmic… as you get closer to 100% your chances of winning increase more and more, with about a 39% advantage if you’ve voted on 100% of the events.
Of course, you can’t just abuse the system. We’ve got automated and manual checks in place for people who are just randomly voting - clicking all the same vote, voting in patterns, or voting with very little time separation between votes. All of those things will trigger a manual review, and you can be banned for life for attempting to game the system. We’re also tracking IP addresses and whatnot, so if you’re voting from multiple accounts, or trying to upvote your own entries… we’re going to just shut you out. You won’t even necessarily be notified, because we’re not confrontational folks.
But I know nobody’d do all that - we’re all in this to make the Games fun and educational! So get in there and vote. And leave comments. If you vote 1-star, tell the author why, so they can improve. Hey, it’s what YOU would want if someone 1-starred YOUR code, right? Right!
So vote! http://ScriptingGames.org!
(PS - please don’t report any tech problems in the comments here. The Games Web site has a feedback link)

Don Jones
Scripting Games

Meet the Scripting Games Judges: June Blender

June Blender is was a senior programming writer on the Windows PowerShell team at Microsoft from Windows PowerShell 1.0 ““ 3.0. You see her work every time you type Get-Help for the core modules. She’s now working on the Windows Azure Active Directory SDK team, and she remains an avid Windows PowerShell user and a passionate user advocate. She’s a guest blogger for the Scripting Guys and she tweets Windows PowerShell tips on Twitter at @juneb_get_help.
An engineering type by disposition, June was attracted to Windows PowerShell by the efficiency, productivity, and uniformity of automation. As a full-time working mom of three sons (now adults!), the idea of doing anything twice, unless it’s fun, is appalling. When evaluating scripts, she looks for elegance, but prefers scripts that inspire to those that intimidate. If saving a line of code makes your script difficult to understand and maintain, it’s not worth it. The scripts that get a thumbs-up from June are those that reveal a new way of performing a task and can be used as a template for scripts to come. Oh, and they must have Help!
June’s philosophy about Help is pretty simple. It’s supposed to make the task easier ““ clear, complete, and accurate. A parameter description that says that ServerName is the name of the server isn’t worth the characters you use to type it, but neither is the one that says that a parameter retrieves the modification of the nth cell in the hierarchically rarified data structure. She hates passive voice, too, because you don’t know who is supposed to act. About topics are critical. A whole mess of disjointed cmdlet help without an explanation of how they are intended to be used is not really helpful. And the best part of help is the examples. You really can’t have too many (see “Get-Help Invoke-Command”).
Community is the secret sauce in Windows PowerShell, so the best scripts contribute to our shared knowledge, productivity, and fun. June much prefer scripts and functions that you can open, read, and model to compiled anything.
A 16-year veteran of Microsoft, June lives in magnificent Escalante, Utah, where she works remotely when she’s not out hiking, canyoneering, taking Coursera classes, or convincing lost tourists to try Windows PowerShell. She believes that outstanding documentation is a collaborative effort, and she welcomes your comments and contributions to Windows PowerShell and Windows Azure Help.

Don Jones
Scripting Games

State of the Games

As of Monday at 5pm Pacific time (which is Tuesday morning, 00:00 hours GMT), the 2013 Scripting Games’ first event will conclude. That means the first event is open for community voting - so get on it!
Remember, some of the best prizes - including a free pass to the 2014 PowerShell Summit - are reserved for folks who offer their votes and comments.
Incoming new registrations for the Games will not be able to compete in Event 1 at this point, but they can jump in with Event 2 (and subsequent events) if desired.
We presently have 1100 registered participants - which may include people who just signed up to spectate and vote, as well as our judges. 475 are registered in the Beginner track, 307 in Advanced, and 318 are presently view-only (meaning they’re just voting, not submitting entries). As I write this, we’ve only got 218 entries - but there are still a few more hours to get them in.

Don Jones
Scripting Games

Meet the Scripting Games Judges: "Scripting Guy" Ed Wilson

Ed Wilson is the Microsoft Scripting Guy and a well-known scripting expert. He writes the twice daily Hey Scripting Guy! blog (the number 1 blog on TechNet). He has also spoken at TechEd and at the Microsoft internal TechReady conferences. He is a Microsoft-certified trainer who has delivered a popular Windows PowerShell workshop to Microsoft Premier Customers worldwide. He has written 11 books including 8 on Windows scripting that were published by Microsoft Press. He has also contributed to nearly a dozen other books. He has two Microsoft Press Windows PowerShell 3.0 books: Windows PowerShell 3.0 Step by Step and Windows PowerShell 3.0 First Steps. Ed holds more than 20 industry certifications, including Microsoft Certified Systems Engineer (MCSE) and Certified Information Systems Security Professional (CISSP). Prior to coming to work for Microsoft, he was a senior consultant for a Microsoft Gold Certified Partner where he specialized in Active Directory design and Exchange implementation. In his spare time, he enjoys woodworking, underwater photography, and scuba diving.

Don Jones
Scripting Games

Meet the Scripting Games Judges: Jeffery Hicks

Jeffery Hicks is a Microsoft MVP in Windows PowerShell, Microsoft Certified Trainer and an IT veteran with over 20 years of experience, much of it spent as an IT consultant specializing in Microsoft server technologies with an emphasis in automation and efficiency.He works today as an independent author, trainer and consultant.Jeffwritesthe popular Prof. PowerShell column for MPCMag.com, is a regular contributor to the Petri IT Knowledgebase, 4SysOps and the Altaro Hyper-V blog, as well as frequent speaker at technology conferences and user groups.

Don Jones
Scripting Games

Advanced Practice Event

I want to direct your attention to this forums post, which I think is worth anyone’s time to look through. I’ve left a pretty long reply with some comments on the entry that would also be worth a read.
I find that a LOT of folks - like the gentleman who posted his script - have a really good approach to PowerShell scripts. They want to use parameters. They want verbose output. They want to proactively check for errors. Where I think folks get lost is in the fine points of how PowerShell enables these features. I see folks working harder than they need to, coding functionality that the shell will actually give them for free. I also see some not-entirely-perfect approaches to things like parameters and error handling, and some occasional mis-use of advanced features (I often see SupportsShouldProcess declared but not actually implemented).
Sometimes, this simply happens because a lot of these advanced features aren’t well-documented in one convenient spot - they’re all spread out - and because folks are learning from blog posts, which may themselves have been written by someone with an incomplete understanding. Or, they’re pasting bits together without really knowing what they’re doing. That’s cool - what you have to sometimes do is take a whack at something like this poster did, and get some feedback. I’m really glad he did, because it offers an opportunity to clear up some misunderstandings, which will just make his scripts even better in the future.
I hope everyone’s looking at the Games as a learning opportunity. I hope everyone will vote on folks’ entries and leave comments when they do; I hope as many people as possible spend some time blogging about what  they see, what they’ve learned, and what they don’t understand. That’s how we’ll all improve.
Let me give you a perfect example (we’re no longer discussing the forums post, here - I’m moving on to a new topic):

Don Jones
Scripting Games

Show Your Scripting Games Pride!

If you’re participating in the Scripting Games, log on to the Scripting Games Web site and check out your Profile page. You’ll find a redemption code that can be used to unlock a Participant achievement on the main PowerShell.org Web site!
FirefoxScreenSnapz001