2012 Scripting Games Beginner Event 2: Find Stoppable Running Services

 2012 Scripting Games badge

Summary: In Beginner Event 2, you have to find stoppable running services.

About this event



Date of Event

4/3/2012 12:01 AM

Due Date

4/10/2012 12:01 AM


Event scenario

You are a server administrator for a medium-sized enterprise company. Your boss wants you to write a Windows PowerShell script to shut down servers across the network. Instead of simply shutting down the servers, he wants you to investigate a more controlled shut down of services prior to actually shutting down the server.

As a first step in this process, you need to find all services that are running that will actually accept a Stop command. You need to run this command remotely against trusted computers that have the appropriate ports open through their firewalls, so your command must work against remote computers.

An appropriate output is shown in the following image.

Image of command output

Design points

  • For the purposes of this exercise, you do not need to have a second computer against which to run.
  • For the purposes of this exercise, you do not need to test firewall connections, nor do you need to configure the firewall. Assume that the appropriate ports are opened.
  • Use the simplest command that will work. You do not need to write an entire script.
  • Display the output to the screen; you do not need to write to a text file.
  • It is permissible to use standard aliases (if any exist). It is NOT permissible to use non-standard aliases that do not exist without special configuration.

2012 Scripting Games links

2012 Scripting Games: All Links on One Page

I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at scripter@microsoft.com, or post your questions on the Official Scripting Guys Forum. Good luck as you compete in this year’s Scripting Games. We wish you well.

Ed Wilson, Microsoft Scripting Guy 

Comments (30)

  1. mredwilson says:

    @LA Richards This is often true. I am trying to clarify this for these games because in previous years we have had situations where someone turned in a 200 line script when a simple one-linner would suffice. It also depends on the situation. For example, if I do something only for myself, I may not write a script, but instead do a one-linner. But if I am writing something for the help desk to run, I may do a script, and even include a graphical interface to allow them to run the script by point and click.

  2. mredwilson says:

    @Dan Yesterday there were hundreds and hundreds of scripts submitted. I am sure that is the same for today. I am hoping that each script submitted will be graded at least two times. When a script event has five design points … you can translate that to five points. For each point that it does not meet, one point is subtracted. I have written does not meet all the requirements many times in the scripts I have graded. It will take a judge a really long time to list which requirement you script met and which it does not meet. Keep your eyes out for the Expert commentaries that will start next week. Also pay attention to the blogs of the various judges and their tweets as some judges, rather than writing the same thing hundreds of times over and over, prefer to write a blog post. I appreciate your desire to learn, and that is exactly the point of the games, but keep in mind there are only 30 judges, all of whom have other jobs, and some of whom will only be grading at night and on the weekend. The biggest goal is to grade the scripts. The second goal is to provide some feedback when possible.

  3. mredwilson says:

    @Killian Bummer. Keep in mind that you have an week to turn in your submission. Most of the time it is good to wait and come back to it a little later. Make sure to carefully read the requirements. On this entry, especially, I am seeing LOTS of scripts that do not meet the requirements of the scenario. See the Scripting Wife's article about what to expect in the Scripting Games for some great tips from a veteran of the Games blogs.technet.com/…/what-to-expect-during-the-scripting-games.aspx

  4. Anonymous says:

    Are aliases preferred?

  5. mredwilson says:

    @Joe Keohan Not as long as the object contains the essential information. It can certainly be a custom object instead of a native ServiceController object.

  6. mredwilson says:

    @rba For this scenario, you can use -computername LocalHost, or $env:comptuername you do not have to write a script that accepts a command line parameter. There are also many other things that can be done as well. In fact, the design requirement only says that the code you use should be CAPABLE of running remotely … it does not say that your specific code must run remotely.

  7. Anonymous says:

    Just checked the scripts I have submitted.  The one I submitted for this one is showing as though I have submitted it for the Advanced section.  Can this be changed to Beginner, as this is where it should be?

  8. mredwilson says:

    @Brad there are five points listed in the design criteria. That means that if your one-linner meets all five criteria it is an excellent submission.

  9. mredwilson says:

    @brad no, do not shut down the services, only necessary to identify them.

  10. mredwilson says:

    @Freak @Michael Moore I am copying my comments from beginner event 1 that relate to the issue of grading: @Erunama Hmmmm ….. if you have 2.5 points, then it means that you have received at least two grades. One better, and one not as good from the judges. The judges all have their own ideas of what is a good script, and what is not. The rules say that aliases are acceptable, not that they are required. Often a judge will mention things (I know that I do) in the comment that is NOT directly related to the actual grade I give. I want to give hints that might make you a better scripter. For me, when I am grading, if the design says an alias is acceptable, that means you will NOT loose points for using them, but you do not gain points for using them either. I have added that very comment, that the command could be shorter by using aliases, but it did not affect my specific grade. The grading is this: the command should be capable of running remoting = 1 point. The command should return an object = 1 point. You should be able to write to a file = 1 point. The script should work and meet the requirement of the scenario = 2 points. So there are your five points. You lose a point or two points if you miss any one of these things. Keep in mind, the judges all have their own ideas, I have given them guidelines, but they are all free to express their own judgement.

  11. Anonymous says:

    i can't find the link to submit my solution.  i was able to submit yesterday's solution without any issue. please advise.

  12. Anonymous says:


    From what I understand once the event closes a full five star solution will be posted with comments from judges.  I expect this will clarify why we've scored what we did to some degree.

  13. mredwilson says:

    @Mr Killian no. When the event closes, I will post a script written by an expert. These scripts, and their commentary are not THE ANSWER, merely they are an answer. In some cases, the expert script looks an aweful lot like the script I wrote, when I wrote the event…. in some cases, the expert answer is radically different. With Windows PowerShell there is never only one way to do things. This is the fun part about the Scripting Games … at least for me. I device the scenario, then I craft a solution to the scenario. I use my solution to gage if the event is too hard, too easy, or just about right. I then may make some changes to the scenario to bring it better in line with expectations. If I am still not certain, I will privately send the scenario, and my proposed answer to a peer and ask for their opinion on the matter. Once all is set, then I invite world reknowned experts to submit their solutions to the events. These solutions are their solutions … not my solutions. In some cases the two are similiar, but as I have said, sometimes they are not. This is part of the value. If you want to SEE a five star example, you should go to posh code, and review the answers that received five stars from the judges. This is also a great place for learning.

  14. mredwilson says:

    @shiv_09 you use the same link to submit that you did to register:

  15. Anonymous says:

    How did you get your score?

  16. mredwilson says:

    ArchSpyder64 as the judges grade your script, you will receive a score and possibly comments on your submission. Later, a leaderboard will be displayed that will show who is leading. Keep in mind that any script can be graded at anytime between now and April 15th, so the leader board will change constantly.

  17. mredwilson says:

    @Greathan A. design point 5 says they are permissible … when I grade, I am not holding it against you one way or the other. However, if you created your own custom alias that would not be universal, then I would hold it against you (also mentioned in point 5).

  18. @member2712

    Please email to scripter@Microsoft.com and give him the full URL of the exact submission that is wrong… for example this is the URL for my event one. 2012sg.poshcode.org/2005

    Ed will then check with Joel about changing the category.

    @Everyone.  Please double check your category and event this is a manual process for Joel to correct the submission and can only be done if he is not overwhelmed with them.

  19. LA Richards says:

    It seems to me that a good scripter knows when scripting is appropriate and when it isn't.  Correct?

  20. walid toumi says:


    you must register here:


  21. brad says:

    am I reading this correct that we only need to find services that can be stopped or do we continue with the shut down process as well?

  22. brad says:

    also I'd like to clairfy the judging criteria, this says "Use the simplest command that will work. You do not need to write an entire script."

    does this mean that you will get extra or lose point for making a full script?

    I ask because I felt that I got robbed on event 1 for only posting a one-liner when that was all that was asked. (of course the was no feed back as to why the score was what is was)

  23. Rba says:

    how do we get the remote computer name ? as parameter ?

  24. Dan_IT says:

    Not to complain, but I'm finding the judging somewhat confusing.  I really like some of the feedback since it tells you what the judge is thinking which is VERY valuable.  Unfortunately, a comment of "Does not fully meet requirements" doesn't help me learn how I can improve a script.  I've re-read the requirements and the script multiple times and am not seeing what I'm missing.  I like the Scripting Games because they're a very good learning opportunity, but I'd like to be able to learn from mistakes if there is something that the judge is seeing.  I get that they're doing this for free, and am guessing that there is a LOT of work put into these, but just wanted to put out there that even a small nudge in the right direction is appreciated.  

  25. Killian says:

    I've just realised I've made a stupid mistake a few hours after submitting my script! Argh!

  26. Freak says:

    Hi Ed and everyone who is participating in the scripting games,

    i'm a little bit confused about the judges decision. I'm pretty sure my "script" does exactly what it should and i ask myself what to improve to get higher ratings and more stars?

    Thanks for all your hard work =)

  27. Michael Moore says:

    @Freak I have to agree I am not clear as to how my scripts get the rating that they do.  One judge may give 5 stars another may give 3.  This is my first year doing this so I'm guessing we will need to take the "wait and see" approach.

  28. Joe Keohan says:

    Does it matter the type of object returned as in PSCustomObject vs. ServiceController?

  29. JamesStallwood says:

    Haha I got a 1 out of 5 in this event.  One star is just for entering!

  30. John Carter says:

    Very nice game.Thanks for sharing…
    http://www.winipads.com“> Facebook

Skip to main content