Powering into PowerShell fame via the 2012 Windows PowerShell Scripting Games
- Posted: Apr 02, 2012 at 6:00 AM
- 5,414 Views
Are you a PowerShell hero? Do you write scripts in your sleep? Does the thrill of seeing your name at the top of leaderboards drive you to excel? Or do you just need a little motivation to kick your PowerShell learning into gear?
Today is your day...
Microsoft Scripting Guy, Ed Wilson, is here. The 2012 Windows PowerShell Scripting Games begin on April 2, 2012, and they run through April 13, 2012. The Scripting Games are the premier learning event of the year for IT pros, devs, and others who want to learn Windows PowerShell. Think you already know all there is about Windows PowerShell? Then register to compete in the Advanced category and compare yourself against some of the best Windows PowerShell people in the world. New to Windows PowerShell? You need to learn it, and learn it quick. Windows PowerShell is rapidly becoming the essential skill for IT pros, and all the new applications from Microsoft are absolutely burgeoning with Windows PowerShell features.
Just like last year, each day during the games, a new scenario will appear on the Hey, Scripting Guy! Blog. And just like last year, you will have exactly seven days (until 11:59 P.M. Pacific Standard Time) to submit your answer. An internationally recognized panel of judges (a veritable who’s who in the Windows PowerShell world) will grade your submissions. Daily leaderboards and random prize drawings will keep the interest in this exciting event to a near fever pitch for the duration of the games.
This page includes all the essential links for the 2012 Scripting Games. Add this page to your Favorites list, and check back on a daily basis. For that matter, add a tab to your browser, and make it one of your Home pages. As we progress through the games, I will be filling in the blanks.
Need some more reasons to participate?
...I mentioned several reasons for competing in the games. I would like to state my top ten reasons for competing in the 2012 Scripting Games.
- It is a great chance to learn Windows PowerShell.
- It is a great chance to receive a free critique of your PowerShell scripts by some of the best scripters in the world.
- It is a tremendous opportunity to compare your scripting skills with other people around the world.
- It is a great opportunity to learn from your peers, as you see their solutions to the same event that you spent hours pondering over.
- It is an excellent opportunity to learn from experts, as you compare your solution to the one developed by one of the expert commentators.
- It is a great way to meet new friends, as you share your experiences in the games on Twitter, Facebook and other social media sites.
- It is a fantastic time to learn from your peers as you read their blog posts about their experiences completing various Scripting Games events.
- It is a great way to win swag as you peer over the daily prize listings.
- It is a nice way to spend a couple of weekends as you write solutions for different events, review entries submitted by your peers, and read about shared experiences on various blog postings.
- It adds excitement, and a bit of competition to what could otherwise be called work.
How are those awesome scripts you're going to write judged?
General criteria for good Windows PowerShell scripts
- You should be able to read and understand your script. If you cannot read and understand your script, you will never be able to effectively modify it or troubleshoot it.
- Use native Windows PowerShell cmdlets and capabilities unless a clear cut reason dictates otherwise.
- Use comment-based Help.
- Format your script to facilitate reading and understanding of the script.
- Line up related items, and indent subordinate or dependent items.
- Use comments, but avoid in-line comments. Instead, place comments on their own line ahead of the code to which the comment refers.
- Avoid aliases in scripts.
- Write your code so that it can be read without requiring horizontal scrolling. To do this, consider using variables and natural line breaks (such as the pipe (|) character). Avoid line continuation marks if at all possible, but not at the expense of creating really long lines of code.
- Leave the pipeline character on the right side of the code.
- Put at least one space between commands.
- Place individual commands on individual lines unless the command is exceedingly short and separating the commands would hinder readability.
- Keep the integrity of an object as long as possible. Avoid using Write-Host.
- Write reusable, self-contained functions.
- Functions should return objects.
- Use Verb-Noun naming for functions.
- Prefer the singular for nouns in function names.
- Functions should accept piped input if it makes sense to the application.
- Do not call a function like a method.
Specific grading criteria
All scripts are graded on a five-point scale.
- One point is awarded for a submission. All scripts will receive at least one point.
- One point is awarded if the script runs and meets the minimum requirements of the scenario.
Therefore, a submitted script that runs and meets the requirements of the scenario will receive two points. If a script runs, but DOES NOT meet the requirements it will only receive 1 point, which is the same score as a script that attempts to meet the requirements of the scenario but does not work.
- The other three points depend on the scenario.
In most cases, there will be four or five specific criteria that a script must meet. To receive all five points, a script must meet all of these criteria. If a script omits one criterion, one point is taken from the total of five. Therefore, a script would receive four points if it met all but one of the criteria and it worked properly.
If a scenario only lists two criteria, and the script worked properly and met both of the criteria, the script would receive five points. A script that only met one of the criteria, would receive only four points.
However, there is an evaluation process on the part of the judge—a judge may decide that a script is only worth 2 or 3 points instead of four or five.
Something new this year is that if you want, you can use the still in beta PowerShell 3.0 (found in Windows Management Framework 3.0 - Beta).
In a major departure from previous rules, if you want to compete by using the beta version of Windows PowerShell 3.0, you are welcome to use it. You will be limited to the most recent version that is publically available, and you must specify that when you submit your scripts.
Ready to get started?
Now that you know why you need to sign up for the 2012 Scripting Games, I am going to ask the Scripting Wife to come help us get signed up for the games. (I would do it, but I am a judge, so it would not be fair.)
I pick up my Windows 7 phone and call the Scripting Wife. The nice thing about our phone provider is that phone-to-phone calls are free on the same service plan. So we use our Windows 7 phones sort of like an intercom or like a walkie-talkie at home. It prevents yelling—which just seems a bit rude. We also use our phones to send SMS messages to each other when we are dining out, but that is another story.
The Scripting Wife appears at the door to my office, and I greet her with an affectionate and heart felt greeting.
“I need you to come over here, so we can get you registered for the 2012 Scripting Games,” I exclaim.
“What, no ‘Hi, how are you doing?’ No ‘I have a special surprise for you today’? No nothing…just come over and get signed in,” she complained. ”How wude!”
“Sorry. Hey, why don’t you come over, I have a special surprise for you,” I said smiling.
“Too late, I already know what it is. The sign-up page for the 2012 Scripting Games is live,” she said.
“OK. You need to go to http://2012sg.poshcode.org/. When you get there, you need to click on the Log On button in the upper-right corner,” I said.
The Scripting wife typed http://2012sg.poshcode.org/ into Internet Explorer 9, and watched as the page navigated to the new PoshCode site for the 2012 Scripting Games. The 2012 Scripting Games PoshCode page appeared on her screen as follows, and she turned the monitor so I could see it.
So now that you're signed up (or just want to follow along) but maybe you need a little help getting started?
More important than competing online and receiving prizes and a certificate is the acquisition of new Windows PowerShell skills. The ten areas emphasized in this year’s games represent “bread and butter” type of knowledge that you will be able to use immediately. To this end, I hope that you will use this study guide, even if you do not participate in the games.
Note Remember the Scripting with Windows PowerShell page in the Microsoft Script Center. It points to lots of great resources including podcasts, webcasts, and even a Windows PowerShell quiz.
- Working with computer hardware
- Working with dates
- Working with ETW logs
- Working with XML
- Working with classic event logs
- Working with CSV files
- Working with folders
- Working with text files
- Working with services
- Working with processes
See you on the Leaderboards!