2012 Scripting Games Advanced Event 1: Review a Coworker’s Script

2012 Scripting Games Advanced Event 1: Review a Coworker’s Script

  • Comments 53
  • Likes

 2012 Scripting Games badge

Summary: Advanced Event 1 of the 2012 Scripting Games asks you to review a coworker’s script.

About this event

Division

Advanced

Date of Event

4/2/2012 12:01 AM

Due Date

4/9/2012 12:01 AM

 

Event scenario

You work as a network administrator for a large company. You are part of a team of other network administrators that monitor several mission critical applications. Your coworker has convinced your boss that he knows everything about Windows PowerShell. As a result, whenever any scripting needs to be done, he always gets the nod. Recently, however, your boss has begun to have some doubts, and the boss has asked you to do a code review of the script that is shown here:

MonitorNotepadFor10Seconds.ps1

$notepad = Get-Process notepad

for ($i = 1 ; $i -le 10 ; $i++)

{

 start-sleep 1

 $notepad

}

When you run the script, you receive the output that is shown here:

Image of command output

Design points

  • If no changes are required to the script, put “No changes” in your entry for this event.
  • If changes are required:
    • Make the minimum number of changes to the script. Points will be deducted if you make too many changes.
    • Consider the performance of the script when you make changes.

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 

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Hi Ed,

    the games have begun! WOW!!!!

    And this short first advanced event already might knock me out ... :-)

    I'm reading through this event over and over again and I really have no clue how to solve it having no knowledge of the concrete job definition behind it!

    Could you clarify the task, the boss has been asking for, please!?

    Klaus.

  • Klaus. I had some problems figuring this one out myself, but got it in the end. There information needed is there ;) Good luck!

  • You're probably trying to read too much into it Klaus, I did the same with Beginner Event 1, spent a while trying to do too much and then decided it didn't have to be as complicated as I'd first thought.

  • @Øyvind @Bob: Thaks for replying to my problem!

    Maybe ... it really should be sufficient to take it easy and write the answer down ...

    But depending on the concrete task description, my answer could vary :-)

    Anyway: Good luck to everybody!

    Klaus.

  • @Øyvind @Bob: Thaks for replying to my problem!

    Maybe ... it really should be sufficient to take it easy and write the answer down ...

    But depending on the concrete task description, my answer could vary :-)

    Anyway: Good luck to everybody!

    Klaus.

  • Hi Ed,

    Are we talking about a true minimum number of changes, or the minimum number of changes to ensure the script is following PowerShell best practices for writing a script?

  • Good question Alex. I was wondering the same thing actually.

  • @Alex: that's one reason, why I'm stuck and I have been asking similar questions.

  • And if the notepad is not running? I have to display a message?

  • Hi Fábio Jr,

    You should make the minimum amount of changes to the script.

    Martijn.

  • I got caught overthinking this one as well but cracked it now :D

  • @Martijn @Fábio Jr: Well martijn, this is part of our event description ... yes!

    But "minimum amount of changes" to achieve .... what?

    Even though I can easily see that the script to review is not working the way, I would expect it to work ... the question from Fábio Jr is something I would seriously consider to be a potential part of a minimum change ( again: to achieve "what"? )

    Klaus.

  • How do I submit my Scripting Games 2012 entries? I've tried to go to the Scripting Games 2012 page but get an Access Denied error? What's happening? Also can I submit in both Beginner and Advanced?

  • @Neptune443: You should read the article blogs.technet.com/.../how-to-register-for-the-2012-powershell-scripting-games.aspx

    I'm afraid you have to choose only one category ... beginner vs. advanced

    Klaus

  • K_Schulte, no worries. It was the link above to "All Links on One Page" which was broken, at least for me. :)