The 2011 Scripting Games Advanced Event 2: Use PowerShell to Identify Status of Service Dependencies


2011 Scripting Games badge

Summary: Advanced Event 2 in the 2011 Scripting Games uses Windows PowerShell to identify the status of service dependencies.

About this event



Date of Event

4/5/2011 12:15 AM

Due Date

4/12/2011 12:15 AM

Event scenario

You are on the server team for a large metropolitan bank and you have been tasked by the team lead to produce a detailed report about services and dependent services. Specifically, your team lead wants you to report what services are currently running on each server. In addition, the team lead wants to see what dependent services each running service has and whether or not the dependent services are also running. All of your teams servers are running Windows Server 2008 R2, and your domain contains one server running Active Directory Domains Services (AD DS) on Windows Server 2008 R2. The remaining domain controllers are either Windows Server 2008 or Windows Server 2003.

For the purposes of this scenario, it is not necessary to write the results to a file, but the script should include the capability to run against multiple remote machines. The remote machine names should not be hard-coded, but they should come from a text file, Microsoft Excel spreadsheet, database, or AD DS. Because you are on the server team, you should not bother querying desktop machines. Your report should include only services that are running, but the report of dependent services should include all services regardless of whether they are running or not. Therefore, your output might look something like the output that is shown here.

Image of command output

Design points
  • Extra points for querying AD DS for servers
  • Extra points for including a filter to detect only computers that are running a server operating system
  • Extra points for reusable code

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, 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