The 2011 Scripting Games Advanced Event 4: Use PowerShell to Investigate the SvcHost Process

2011 Scripting Games badge

Summary: Advanced Event 4 of the 2011 Scripting Games uses Windows PowerShell to investigate the SvcHost process.

About this event

Division

Advanced

Date of Event

4/7/2011 12:15 AM

Due Date

4/14/2011 12:15 AM

Event scenario

You are the network administrator for a large company with multiple locations around the world. Your performance team has expressed concern with the large amount of memory that is consumed by one particular instance of the SvcHost process. To investigate this process, the team lead has requested that you write a Windows PowerShell script that will list each instance of the SvcHost process, the amount of committed memory, the number of page faults, and the command line that launched each SvcHost process. In addition, the lead requires that the script list each service that is running inside each instance of the SvcHost process. An appropriate output from the script is shown in the following image.

Image of command output

Design points

  • Because the performance team is only concerned with a single server, you do not need to provide provisions to run against multiple servers.
  • Extra design points for reusable code
  • Extra design points for a server that will produce a written report
  • Extra design points for a script that returns objects instead of string data or a table.

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