2012 Scripting Games Advanced Event 10: Create a CSV Log File

Doctor Scripto

Dr Scripto

  2012 Scripting Games badge

Summary:  In Advanced Event 10, you want to create a CSV log file of all the counters in the Processor counter set.

About this event

Division

Advanced

Date of Event

4/13/2012 12:01 AM

Due Date

4/20/2012 12:01 AM

Event scenario

You are a server admin, and you are concerned about the processor performance of one particular server. You decide to use Windows PowerShell to create a CSV log file of all the counters in the Processor counter set. You decide to take the counter snapshot at two-second intervals for a total of ten snapshots. You plan to analyze the data in a Microsoft Excel spreadsheet. An acceptable output is shown in the figure that follows. Create the CSV file in the Documents special folder for the current logged-on user. The file name should be servername_processorCounters.csv.

Image of command output

Design points

  • Make sure that you include all of the counters for all instances of the processor object.
  • Make sure that the saved CSV file is readable from within Microsoft Excel.
  • Make sure that you get the number of snapshots with the prescribed time between snapshots.
  • This can be a “one liner” single logical command. Do not write complex, difficult-to-understand script because you will lose points.

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 

0 comments

Leave a comment