Microsoft Scripting Guy Ed Wilson here. It was a rough night because PoshCode was down. That is unfortunate, of course. However, having been a network administrator and a consultant, I know that servers do not always behave nicely, and at times applications decide to crash. When I was just starting out as a network administrator and users would call up complaining, I would say, “Computers never do anything you do not tell them to do” and launch into a lecture. Boy, was I naïve when I was young. These days, I am firmly convinced there is a hidden annoyUser process that senses your preferences, and selects the exact opposite action at random times—just to keep things interesting. Every once in a while I run the command seen here to look for the mysterious process.
PS C:> Get-Service annoyuser | stop-service
Get-Service : Cannot find any service with service name 'annoyuser'.
At line:1 char:12
+ Get-Service <<<< annoyuser | stop-service
+ CategoryInfo : ObjectNotFound: (annoyuser:String) [Get-Service], ServiceCommandException
+ FullyQualifiedErrorId : NoServiceFoundForGivenName,Microsoft.PowerShell.Commands.GetServiceCommand
It always errors out, but one of these days, I will catch it in memory and it will be gone. Wait…it seems that PoshCode is back up.
“I need to log in and grade a few scripts,” I thought to myself.
I was busy analyzing a script entry and was so engrossed in my work that the Scripting Wife’s arrival took me completely by surprise.
“Two! I got a two on my script! I got a two on my script from yesterday. Why?” she exclaimed in a rather loud voice.
“Uh, I am sorry. I didn’t hear you come in, now what were you saying?”
“I got a two for event number two.”
“Well, that is cool. Maybe you will get a three for event three, a four for event four, and on until event six when you start over again,” I suggested, mostly unhelpfully.
“Why did I get a two? It was a perfectly good script,” she asked sincerely.
“Well my dear,” I began,”as you said it was a perfectly good script. It met the requirements, but was not anything special. There were no extras. That is the definition of two stars.”
“Huh? I don’t get it.”
“According to the grading scale I created, two stars means the script meets the requirements of the scenario. Stars three through five are for style and design. A five-star Windows PowerShell script would use features of an advanced cmdlet, incorporate error handling, and integrate with Get-Help. A three-star script would have comments and maybe a few extra things.”
“I don’t know how to do all that,” she said.
“That’s okay. You don’t have to. Just keep in mind that two stars is perfectly acceptable. It is a good score. We just needed a way to reward people who spend a lot more time on their scripts, and who make the script more like an application than a one-line command. You are doing fine. Hang in there.”
“If you say so,” she said as she turned to slouch off.
“I do say so. You are doing great. Just think how far ahead you are of all those people who registered for the Scripting Games and have not submitted anything yet. You were number 20 in the most recent rankings. That is top tier. You are a contender.”
“Contender for what? You said I cannot win any prizes.”
“That is true, but if you do well, I will take you out to eat at a world-famous restaurant.”
“Great, McDonalds here we come,” she said sardonically as she turned and left.
Now that the Scripting Wife is out of my hair, let me invite you to keep up with the 2010 Scripting Games by following us on Twitter or Facebook. If you have any questions during the Games, send e-mail to us at email@example.com or post your questions on the 2010 Scripting Games Forum. See you tomorrow. Until then, peace.
Ed Wilson and Craig Liebendorfer, Scripting Guys