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.

Searching for Scripts

  • Advanced8_2011 by Glenn Sizemore 15 Apr 2011 12:18 AM UTC
    by 3 users

    Advanced Event 8
    1 Comments

    PowerShell WinForm GUI that will convert, and sanitize images to be uploaded to the web. I chose to not use any external dependencies, as a result Script will run on any system windows XP SP3 and up. Script saves user settings to the registry. This challenge was a monster, as a result I recommend you run the script before reading the code as it will help ingest everything that is going on.

  • Beginner5.ps1 by Sadie Trest 15 Apr 2011 03:19 AM UTC
    by 2 users

    Beginner Event 5
    3 Comments

    This script opens uses a computer name, or reads a file and passes it to a cmdlet. The cmdlet opens attempts to open a session to a comptuer and retrieves environment information and saves the results in a file using a specified filename or a default filename.

  • Beginner5_2011.ps1 by Albert Fortes 15 Apr 2011 05:37 AM UTC
    by 3 users

    Beginner Event 5
    1 Comments

    Collect Basic Computer Information.

  • advanced9.ps1 by Tim Parkinson 15 Apr 2011 05:40 AM UTC
    by 2 users

    Advanced Event 9
    1 Comments

    A single function which creates the daily log file, assumes it is called by another routine. Creates the file, doesn't overwrite it if it already exists and is silent unless -Verbose is requested or an error is thrown (which it deliberately doesn't handle because it is expected to be called by another routine). Meets the Extra Credit functionality by creating the logfile folder if it doesn't exist and also creating it in the My Documents folder of the user. Additionally accepts parameters to override any of the default values.

  • SG2011_beginner8 by KSchulte 15 Apr 2011 10:48 AM UTC
    by 2 users

    Beginner Event 8
    2 Comments

    Beginner Event 8 of 2011 Scripting Games uses Windows PowerShell to report disk space that is consumed by files in a folder.

  • SG2011_beginner9 by KSchulte 15 Apr 2011 12:21 PM UTC
    by 2 users

    Beginner Event 9
    1 Comments

    Beginner Event 9 in 2011 Scripting Games uses Windows PowerShell to create a file with a name that is based on a date. ( I really tried to make it simple!!! ... but errors have to be handled and some params should be OK :-)

  • Write-DateBasedLogFile by ICC_AndyC 15 Apr 2011 12:32 PM UTC
    by 2 users

    Beginner Event 9
    1 Comments

    Writes a log file with a specific date format to the file name and some test content. The format for the log file name is "yyyyMMdd.log". If the filename already exists, the user is prompted to enter another name.

  • BeginnerDay6.ps1 by 52c286bdf7fa6488cd3cde9ca24538f7 15 Apr 2011 02:23 PM UTC
    by 2 users

    Beginner Event 6
    1 Comments

    Finds Windows Update errors

  • Test-SleepTiming by ICC_AndyC 15 Apr 2011 03:16 PM UTC
    by 2 users

    Beginner Event 10
    1 Comments

    Measures the actual time it takes to execute a sleep command. For a given number of times, measures the time it takes for the Start-Sleep command to execute. Prints a message containing the number of runs, sleep time, and the average sleep time.

  • New-LogFile by Jason Hofferle 15 Apr 2011 04:50 PM UTC
    by 2 users

    Advanced Event 9
    3 Comments

    The scenario described the need to add a logging routine to an existing script. I thought a good approach would be to create a function that returned the full path of the log file, or null if the file already existed. The function defaults to creating a log with the path and name outlined in the event, but that information can be modified through function parameters.

  • Test-Duration by Jeffrey Smith 15 Apr 2011 05:07 PM UTC
    by 2 users

    Beginner Event 10
    1 Comments

    A quick function to test the average duration of a given cmdlet. This was a quick fun function to write -- go splatting!

  • Get-WUAULog by Arposh 15 Apr 2011 06:07 PM UTC
    by 2 users

    Beginner Event 6

    Function that allows the user to get the Windows Update Automatic Update log from the system drive of a machine.

  • Add-ContentToTempTextFile.ps1 by Matthew BETTON 15 Apr 2011 09:20 PM UTC
    by 2 users

    Advanced Event 10
    1 Comments

    The Add-ContentToTempTextFile function adds string content to a temporary random file name.

  • ESORT by toumi walid 17 Apr 2011 08:06 AM UTC
    by 2 users

    Beginner Event 6

    advanced sort function

  • New-Log.ps1 by Bartek Bielawski 17 Apr 2011 10:35 AM UTC
    by 2 users

    Advanced Event 9
    1 Comments

    Script that solves Adv9 event. It does all automagically without any info sent to user. However you can always try to force it to. Use -Confirm to get prompted in some situations (rename folder to create file or other way around) and -Verbose to see what is going on. It takes into account situation, where there is folder named like log file, and file name like log folder. It's not in scenario, but may happen and I assumed it would be wise to take this into account. ;)

  • Library-TempFile.ps1 by Bartek Bielawski 17 Apr 2011 06:33 PM UTC
    by 3 users

    Advanced Event 10
    2 Comments

    Script with single function to create temporary files from pipeline input. Need to dot-source it in order for it to work, thus name of the script. I tried to use all good things that come with advanced functions. I even managed (finally ;) ) to get proper support for 'Yes to All' and 'Now to All' in process block, usually it was asking regardless option selected... ;) I used -confirm:$false to prevent cmdlets from picking up $ConfirmPreference (they would prompt user again). Was not sure which verb too choose (Out or New) - finally decided to go with New, as we create things rather than redirect stuff to something that is always there (like Host... or Null ;) ).

  • Set-SharedImages.ps1 by Matthew BETTON 17 Apr 2011 07:25 PM UTC
    by 2 users

    Advanced Event 8
    1 Comments

    Set-SharedImages.ps1 uses Windows Presentation Foundation (WPF) for displaying a user interface. This Graphical User Interface allows the user to : - Browse a directory for images (*.jpg, *.bmp, *.gif, *.png) ; - Displays Metadata informations for each image ; - Prepare one image or all images. For each image : - An output resized image is generated (640 x 480) ; - Metadata informations from original image are not kept ; - New image is saved as "SHARE_[].JPG", in selected destination folder. To work correctly this script needs : - "PowerShell Community Extension" Module : if not present in the modules folder, the script displays a message to inform the user where he can find it. The Pscx module is needed for resizing operations (Import-Bitmap, Resize-Bitmap and Export-Bitmap). - "Microsoft Windows Image Acquisition Library v2.0" library : if not present, the script automatically downloads it and install it, in the script current directory. The WIA library is needed for retrieving and displaying image file metadata. The script saves parameters (Source and destination folders) in the user's registry, under HKEY_CURRENT_USER\Software\ScriptingGames2011\ShareImages. You can use $DebugPreference variable in order to display DEBUG informations. Set $DebugPreference to "Continue" and the script will display DEBUG messages.

  • Set-Pictures by Boe Prox 18 Apr 2011 02:56 PM UTC
    by 2 users

    Advanced Event 8
    2 Comments

    My entry for Advanced Event 8 contains a few features not required for the games, but I felt that if I was going to do something like this, I might as well have some fun with it. There are 2 ways to determine both the source and destination folders, either by typing in the path in the text box (and clicking Load Pictures for source) or by clicking on Browse Folder and opening a dialog to select the folder. For the source folder, once you select the source containing the pictures, all of the pictures will be populated on the left column. Clicking on a picture will display its metadata in the far right column and display the picture in the middle box. You can then right-click on the picture in the right hand column and select to just prepare that one or you can click the prepare pictures button to process all of the pictures. Optionally, you can go to the Photo Menu and select a couple options to change the size and type for the saved pictures. A progress bar is also used along with a status bar to show where the processing is at. And lastly, all settings to include Source folder, Destination folder, photo size and type are saved to a pictureutility.ini file so the same settings can be loaded again upon start up. Keep in mind that the settings are stored in the same path of where you called the script from. This event was a lot of fun and I hope you enjoy my creation.

  • share-imageswithoutmetadata.ps1 by David Moisan 18 Apr 2011 07:00 PM UTC
    by 3 users

    Advanced Event 8

    GUI app that lets one preview images and their metadata in a directory, then make new copies scaled for email in a separate directory. Based on Windows Forms

  • PSExifViewer.ps1 by Simon Fuhrer 18 Apr 2011 08:20 PM UTC
    by 3 users

    Advanced Event 8
    2 Comments

    Greets to Marc :-)

  • AdvancedEvent8 by Nuno Mota 18 Apr 2011 08:43 PM UTC
    by 3 users

    Advanced Event 8

    This script depends on: - Windows Image Acquisition Automation Library v2.0 Tool from http://www.microsoft.com/downloads/en/details.aspx?familyid=a332a77a-01b8-4de6-91c2-b7ea32537e29&displaylang=en - PowerShell Pack from http://archive.msdn.microsoft.com/PowerShellPack If these requisites are not met, the user is taken to the webpage where he/she can download them. The script: - gets all the tag information from pictures and displays it in a label next to the picture (in the GUI); - it resizes one picture or all pictures (in the same folder) at the same time to destination folder chosen by the user (using another GUI); - when the user saves the picture, all TAG information gets removed from the picture; - when the user saves a picture, its preferences are saved into a txt file in the same folder of the script. This way, the next time he/she starts the script, those preferences are read an applied; - it uses message boxes for possible errors like no pre-requisites met or the user selecting a folder with no pictures; - it allows the user to set the initial folder to gather the images using a GUI; - it allows the user to set a different folder to save the SHARE_ images using a GUI.

  • search-twitterUser by spinlock 18 Apr 2011 09:27 PM UTC
    by 2 users

    Advanced Event 7

    Pulls username to real name mapping from a supplied Web page. Caches the results in a CSV file, which then is used to allow the user to lookup twitter names from their real name, and vice versa. The cache is updates if it is older than a day (configurable by parametes daysOld) Uses Reusable functions - temporary file creation, and ensures that files is deleted. Include Integrated help with multiple usage examples. It is not short - but lots of checking of I/O.

  • convert-imagefile by Nathan Linley 19 Apr 2011 08:11 AM UTC
    by 2 users

    Advanced Event 8

    GUI and CLI script to prepare images for sharing on the internet. Strips the metadata from the file and resizes it to the requested resolution (aspect ratio preserved). The GUI version will allow the user to save their preferences so they can customize the application between uses. CLI allows for the user to pass parameters for the file information and save location as well as resolution to convert to. GUI version shows all metadata, resolution size, output resolution and a preview of the image. Status of all operations are displayed in the status bar at the bottom of the window. The script uses imagemagick as a backend module. If this is not found in the %path% environment variable or in program files directly, the script will notify the user and load up the download page if the user wants to download.

  • New-HSGLog by Matthew Painter 19 Apr 2011 09:45 AM UTC
    by 2 users

    Advanced Event 9
    2 Comments

    Advanced Event 9 in 2011 Scripting Games uses Windows PowerShell to create a file name that is based on the date and the user’s name. The additional features of this script are: 1. Have created a reusable Advanced Function. 2. Accepts pipeline input 3. Save to specific folder or default to current user's My Documents folder. 4. Creates the target folder if required. 5. Option to record log success and failures to Application Eventlog. 6. Option to save log file in different encoding formats. 7. The function is reusable by supplying different parameters. 8. Has error trapping - with user friendly messages (via -verbose). 9. Useful help information is provided, complete with sample usage. Thanks for rating my script.

  • Beginner8_2011_andre.gibel.ps1 by Andre Gibel - CH 19 Apr 2011 10:23 AM UTC
    by 2 users

    Beginner Event 8
    1 Comments

    Beginner8_2011_andre.gibel.ps1