I have been having problem with a computer with random reboots, and hanging on restart. I wanted to know how long the computer had been unavailable. I decided to use System Event ID 12 as the startup event for the purposes of my calculations. The script takes these steps: 1) connect to the remote system and get the oldest event from the System Log. Use this as the earliest start date for queries. 2) Collect all the startup events from user selected date. 3) For each startup event, collect the event immediately previous by record number. 4) Calculate the difference.
Get-DownTime.ps1 is the advanced function which gets the information. It is the first function I have written which includes A Dot Source Reminder for Advanced Functions.