Scripto Bobble-head Games Logo

Welcome to PoshCode and the 2011 Scripting Games!

The Scripting Games are a special event put on by the Microsoft scripting guys. Script submissions, grading, and script archives are hosted by PoshCode.org. You may want to check out the Official Rules, and the Scripting Games Information page for event information and contest details, since this site is purely for submitting your contest entry!

Remember: You will not be able to see other user's scripts until after the deadline for an event has passed, and you will not be able to submit scripts for an event once that event has passed.

Note: If you have any problems logging in, please clear your cookies. If you still have problems, please use the "Contact Us" tab above or post directly on GetSatisfaction.

Recent Contributions:

  • TimingIsEverything by Joe D. 22 Apr 2011 06:30 AM UTC
    by 4 users

    Beginner Event 10
    2 Comments

    Determine the amount of time a command takes to complete.

  • New-TempFileContent by Rich Kusak 22 Apr 2011 04:58 AM UTC
    by 3 users

    Advanced Event 10
    2 Comments

    The New-TempFileContent function creates a temporary file in the Windows temp location and saves content in the file. Optionally, the file contents can be shown by use if the -Show parameter.

  • Beginner10.ps1 by Sadie Trest 22 Apr 2011 04:34 AM UTC
    by 3 users

    Beginner Event 10
    1 Comments

    This script creates a reusable function that executes either the default command or a user supplied command a specified number of times, averages the amount of time each command took to run and returns a string containing the result in milliseconds.

  • run-event10.ps1 by gmb 22 Apr 2011 03:58 AM UTC
    by 3 users

    Beginner Event 10
    1 Comments

    Beginner event 10

  • adv10.ps1 by Francis D 22 Apr 2011 03:49 AM UTC
    by 2 users

    Advanced Event 10
    2 Comments

    Output to a temporary text file in the temp folder

  • New-TemporaryFile by Boe Prox 22 Apr 2011 02:37 AM UTC
    by 2 users

    Advanced Event 10
    1 Comments

    In at the last minute...kind of like last year. This command takes the original requirements of creating a temp file on the user's temp folder that accepts data from the pipeline if used and supports whatif,verbose and debug. After creation of the file, the file path and name is displayed. An option to open the file can be performed using the -DisplayFile switch. In its default state, you can run the command and it will automatically generate a file and save it to your temp folder. Because I felt that was sort of a limited feature, I added the ability to state your own destination path and file if needed. An additional feature is that if the folder path does not exist at the time, the folders will automatically be created for you. Also added is the option to determine what type of encoding you wish to use using the -Encoding parameter and supplying the proper encoding name. When added to a profile, this function will be visible for use.

  • Test-AvgCmdTime.psm1 by Matt_G 22 Apr 2011 02:17 AM UTC
    by 2 users

    Beginner Event 10
    1 Comments

    Test the average time it takes to execute a command

  • Measure-Average.ps1 by Daniel Cruz 22 Apr 2011 02:07 AM UTC
    by 2 users

    Beginner Event 10
    2 Comments

    Function: Measures the average amount of time it takes to run a specified command.

  • Measure-ScriptBlockAverageTime.ps1 by Frank ERBLAND 22 Apr 2011 02:05 AM UTC
    by 2 users

    Beginner Event 10
    2 Comments

    This script measure the average time a scriptblock takes to execute. It runs the scripblock n times and compute the average time with Measure-Command cmdlet. It display a formal message according the asked time unit. By default : It measures the scriptblock {Start-Sleep -Second 5}, 5 times, and shows average result in milliseconds (with 5 digits after decimal point). It also writes the result to the pipeline as an Microsoft.PowerShell.Commands.GenericMeasureInfo object. Possible intermediate results in verbose mode and a progress bar.

  • 2011psa10.ps1 by Polin Yan 22 Apr 2011 01:49 AM UTC
    by 2 users

    Advanced Event 10

    2011 Scripting Games. Advanced Event 10.

  • B_Event_10.ps1 by Eric Pankowski 22 Apr 2011 01:17 AM UTC
    by 2 users

    Beginner Event 10
    2 Comments

    Run the Start-Sleep cmdlet a number of times for a set duration and then report the average amount of time it took to complete each run in milliseconds.

  • Measure-Sleep by Bill Ehardt 22 Apr 2011 12:49 AM UTC
    by 2 users

    Beginner Event 10
    1 Comments

    Function to verify how long Start-Sleep really sleeps. Will ask for parameters if not given and will round the output to the nearest tenth of a millisecond

  • 2011sg_B10.ps1 by Dan 22 Apr 2011 12:48 AM UTC
    by 2 users

    Beginner Event 10
    1 Comments

  • Beginner_10_2011.ps1 by David Temple 21 Apr 2011 11:56 PM UTC
    by 2 users

    Beginner Event 10
    2 Comments

    SYNOPSIS Finds the Average Milliseconds for a CMDLET or Oneliner. DESCRIPTION The Script will process a provided CMDLET or Onliner and determine the Average Millisecond Time it took for PowerShell to run it. IT IS IMPORTANT TO SURROUND THE VALUE OF CMDLET WITH SINGLE QUOTES. PLEASE SEE THE EXAMPLES. After the process finishes it will report the following for example: "Average time of 5 runs of 5 seconds is 4998.5468 milliseconds." PARAMETERS -Iterations Iterations indicates how many times this process will loop through the provided CMDLET or Oneliner (Note: The default value is "5") -CMDLET Name of the CMDLET (with or without Parameters) and or a Oneliner. IT IS IMPORTANT TO SURROUND THE VALUE OF CMDLET WITH SINGLE QUOTES. (Note: You must enter a CMDLET Parameter. It is Mandatory and will prompt you if you forget. Again if you use a CMDLET with Parameters or you are using a Oneliner, surround the CMDLET Value with Single Quotes. See Examples) EXAMPLE .\Beginner_10_2011.ps1 -Iterations 5 -CMDLET 'Start-Sleep -Seconds 5' Average time of 5 runs of 5 seconds is 5004.4389 milliseconds. NOTE: The Single Quotes. EXAMPLE .\Beginner_10_2011.ps1 -CMDLET 'Get-ChildItem -Path C:\Windows\System32 -Filter "*.dll"' Average time of 5 runs of 5 seconds is 150.44608 milliseconds. NOTE: The Single Quotes. EXAMPLE .\Beginner_10_2011.ps1 -Iterations 2 -CMDLET 'Get-ChildItem C:\Windows -Filter "*.txt" -Recurse' Average time of 2 runs of 5 seconds is 821.15165 milliseconds. NOTE: The Single Quotes.

  • Get-AverageRunTime by Jay Morris - Moreski 21 Apr 2011 10:54 PM UTC
    by 2 users

    Beginner Event 10
    1 Comments

    My submission to Beginner Event 10.... Moreski crosses the finish line :-)

  • out-tempfile.ps1 by mjolinor 21 Apr 2011 10:53 PM UTC
    by 3 users

    Advanced Event 10
    1 Comments

    Creates a temporary (.tmp) file in the system temp directory, and writes pipeline input to the file. Encoding and newlines can be specified by parameters, and will optionally open the file in Notepad after writing. Checks for interactive user environment before running Notepad, and prompts for verification before opening large files. Includes support for shouldprocess, provided debug and verbose output.

  • SG2011BE10V1.ps1 by Winfried Schoierer 21 Apr 2011 10:43 PM UTC
    by 2 users

    Beginner Event 10
    1 Comments

    This function calls the Start-Sleep Powershell cmdlet X times for a defined amount of seconds and measures the average execution time.

  • Out-Temp by Miklos Karasz 21 Apr 2011 09:59 PM UTC
    by 2 users

    Advanced Event 10
    1 Comments

    The Out-Temp function sends output to a temporary file. Displays the content in notepad if -Notepad specified. Character encoding can be altered from the default ASCII. The temporary file will not be deleted if -Keepfile is specified. You can pipe string or objects also.

  • Out-TempFile.ps1 by Robert van den Nieuwendijk 21 Apr 2011 09:51 PM UTC
    by 3 users

    Advanced Event 10
    1 Comments

    Submission for the 2011 Scripting Games Advanced Event 10. Sends output to a temporary text file. The temporary file gets a temporary name, and it resides in the temporary folder.

  • beginner 10 by Chris Seiter 21 Apr 2011 08:56 PM UTC
    by 2 users

    Beginner Event 10
    2 Comments

    report back average time a command was run for a specified number of times.

  • Advanced_10.ps1 by Justin Stokes 21 Apr 2011 08:54 PM UTC
    by 2 users

    Advanced Event 10

    This script contains the New-TempFile function, which is a solution to Advanced event 10. The event called for a function, so this script needs to be dot-sourced to run.

  • Measure-CommandTime.ps1 by Isaiah Jesch 21 Apr 2011 08:38 PM UTC
    by 2 users

    Beginner Event 10
    1 Comments

    This script uses Measure-Command to report on the time it takes Start-Sleep to work. Results are measured in total milliseconds and are reported as the average of 5 runs.

  • Beg_10_TS_measure-tests.ps1 by Thomas 21 Apr 2011 08:32 PM UTC
    by 2 users

    Beginner Event 10
    1 Comments

    Submission for Last Event - Function with reusable parameters: Different Tests & Runs can be specified - Looping with: 1..$x | - Verbose Option

  • BE_10.PS1 by Ken 21 Apr 2011 08:13 PM UTC
    by 2 users

    Beginner Event 10
    1 Comments

    Use PowerShell to Collect Basic Computer Information

  • Beginner10_2011.ps1 by Neil Clinch 21 Apr 2011 08:01 PM UTC
    by 2 users

    Beginner Event 10
    1 Comments

    Measure the average accuracy of the Start-Sleep command by performing a number of runs for a specified duration of seconds. Then display the average amount of time in milliseconds.