2012 Scripting Games Advanced Event 6: Compute Uptime for Multiple Servers

Doctor Scripto

Dr Scripto

 2012 Scripting Games badge

Summary: In Advanced Event 6, you are required to compute the uptime for multiple servers.

About this event



Date of Event

4/9/2012 12:01 AM

Due Date

4/16/2012 12:01 AM

Event scenario

You are the server lead for a medium-sized enterprise, and your boss has tasked you with computing the uptime of all servers on the network on a daily basis. This information will be stored in a Microsoft Excel spreadsheet for ease of analysis. Because of the large number of servers, the script will take some time to run; therefore, your boss has decided to compute all uptime as of 8:00 AM local time. If a server reboots after 8:00 AM, but before the report runs, the uptime is zero, and it will be factored into the report for the next day. Create a new report file each day for all the servers on the list. An acceptable output is shown in the image that follows.

Image of command output

Design points

  • Your script should be capable of running more than once per day. If it does, it should not generate an error.
  • Create the CSV file in the logged-on users Documents special folder.
  • The file name should use the year, month, and day that the report runs, with the addition of _Uptime to the file. It will appear like the following: 20120409_Uptime.csv
  • The column headers should appear on the first row only. The headings should be ComputerName, Days, Hours, Minutes, Seconds, and Date.

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 


Comments are closed. Login to edit/delete your existing comments