Scripting Wife comments on 2011 Scripting Games event 2

It is a perfectly lovely Saturday down here in Charlotte, North Carolina. The neighbors are all outside pulling weeds in their gardens, mowing grass, washing dogs, cars, kids and who knows what else. I am not a hang around in the yard on a sunny Saturday afternoon kind of person. To me, the perfect afternoon consists of sitting in a nice air conditioned room with a good book. A close second is hanging out with my friends – maybe at the mall, or getting a pedicure. Hmm, on second thought maybe that is the perfect afternoon – going with a group of my friends to get a pedicure. A distant third is sitting inside on a beautiful sunny Saturday afternoon writing a Windows PowerShell script – and I do mean a distant third; like way way in the distance.

Luckily, this event was really simple. It took me like all of five minutes to write it. Of course, I do not expect to win the games, in fact I could not win the games if I wanted to because I am married to the Scripting Guy and therefore am ineligible. The cool thing is that with Windows PowerShell it did not take me long to solve the problem. Basically what I did was think about hmmmm I need to get information about a service. So I wonder what verb I need – I bet it is get. Next what is the noun that would describe a service. That gave me the cmdlet name I needed to use. I could have used Get-Command and searched for the cmdlet that way, but it would have been too much trouble in this case. I then pipelined the results to Get-Member to see if the cmdlet returned the information I needed. The last thing was to filter out only the services that report that they are able to pause.

I have talked about all of these things in the past. Luckily, I have a good teacher at home, but I am perfectly willing to share. I talked about using cmdlets such as Get-Command last year. The Scripting Guy does not let me mess around with services on my computer, and so I have never written about them before. But he messes around with them all the time, and has written quite a lot about services. Here is a good beginner article that I looked at before starting this event.

Well, that is about it. It is too nice of a day to sit around inside playing with computers. I think I will call up my friends and see what they want to do today. The Scripting Guy is busy grading events for the 2011 Scripting Games so I know he is not going to be any fun today. I am out of here. Look for me tomorrow when I do event 3. By the way, event 1 is due at midnight Pacific Time (-8 GMT) Sunday night April 10 … so you still have time to get into the games.