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

The Scripting Guys

Dr Scripto

  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 

The Scripting Guys
Dr Scripto

Follow Dr Scripto   

No Comments.