2011 Scripting Games badge

Summary: Advanced Event 10 in the 2011 Scripting Games uses Windows PowerShell to create an advanced function to create temporary files.

About this event

Division

Advanced

Date of Event

4/15/2011 12:15 AM

Due Date

4/22/2011 12:15 AM

Event scenario

You find yourself frequently writing data to a text file. Often, you delete these text files later. You decide that an advanced function that will accept piped content to create a temporary text file would be useful. When added to a module or included in a profile, this function would always be available.

Design points

  • The function must be designed as an Advanced function, complete with comment-based Help.
  • The function must accept piped content.
  • The function should return the path to the temporary file.
  • The temporary file should have a temporary name, and it should reside in the temporary folder.
  • Design points for using an appropriate name for this function.
  • Additional points for adding a switch that will display the content of the temporary file in Notepad.
  • Additional points for supporting an encoding parameter and support ASCII and Unicode as encoding types.
  • Additional points for supporting the whatif, debug, and verbose parameters.

2011 Scripting Games links

2011 Scripting Games: All Links on One Page

Submit your scripts on PoshCode

Support our Sponsors!

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