2016-January Scripting Games Wrap-Up

Here’s the official answer to our January 2016 Scripting Games puzzle, provided by Adam Bertram (the puzzle’s author).

Official Answer

This month’s puzzle made you do some work. Not only did it make you write some PowerShell but it also probably forced you to do some background research on the Interwebz as well. Being able to determine how long a computer has been on for isn’t immediately obvious. The puzzle was meant to give you a real-world scenario which would force you to first investigate how that’s even possible before you write your first piece of code. A great scripter doesn’t just know how to write code; they also know where to look for answers relating to the problem they’re trying to automate as well!

Here’s the full solution.  If you have any questions, don’t hesitate to contact me on Twitter @adbertram.


One thought on “2016-January Scripting Games Wrap-Up

  1. selene v

    if the days of uptime are greater than 30, the ‘Uptime (Months)’ is still NULL.

    I would like to propose this patch:

    ## If it’s been up for longer than 30 days, set the MightNeedPatched property to $true.
    if ($daysUp -gt 30)
    { $daysUp = [math]::Round((New-TimeSpan -Start $startEvent.TimeCreated -End $today).TotalDays, 2)
    $output.’Uptime (Months)’ = [math]::Round(($daysUp / 30 ), 2)
    $output.’MightNeedPatched’ = $true

Comments are closed.