CyberDrain Scripting Winners For December Announced!

Hey everyone! I wanted to thank you all for your participation in December’s CyberDrain Scripting Community Event. We have our winners, and these have been sent off to CyberDrain to be written. Once we have them we’ll post them on our Community Scripting Library. Congratulations to the two winning submitters!

1.) Aaron Cheatwood - Script to alert when an asset’s clock has drifted by a variable amount of minutes, including daylight savings and time zone offsets.

2.) Brandon Halsey - Query the laptop battery health and logs a ticket if the battery capacity is below X% (defined in a script variable) of it’s original capacity.

3 Likes

You will love the laptop battery info. We have a variation of it that we use, but it doesn’t generate an alert or ticket.

1 Like

Here is my time offset script:

Import-Module $env:SyncroModule

# US Time Servers
# server 0.us.pool.ntp.org
# server 1.us.pool.ntp.org
# server 2.us.pool.ntp.org
# server 3.us.pool.ntp.org

$ntpServer = 'server 0.us.pool.ntp.org'

# Max offset in seconds
$maxOffset = 60

$currentTime, [DOUBLE]$timeDifference = (& w32tm /stripchart /computer:0.us.pool.ntp.org /samples:1 /dataonly)[-1].Trim("s") -split ',\s*'
Write-Output "Time offset(sec): $timeDifference"

If ($timeDifference -ge $maxOffset) {
    $alertMessage = "Time offset over limit(sec): $timeDifference"
    Write-Output $alertMessage
    Rmm-Alert -Category 'Time System' -Body $alertMessage
}

1 Like

Please note the above script is not the script provided by CyberDrain. This script has not yet been written.

I’m pretty sure I’m the one who suggested the battery script :wink:

1 Like

Ugh so sorry about that. I fixed it. One of those days…

1 Like

It happens. Glad though this script will be made!

Great submission and great choices. I’m already scheming where to use these when they’re out.

1 Like

Sorry Andy, you are correct, I should have worded it “my” script.