Why doesn't this script work? Simple Reboot reminder

This seems pretty straight-forward, and running just Broadcast message part works fine on the test machine. What am I missing?

 Import-Module $env:SyncroModule

$os = Get-WmiObject -Namespace 'root\cimv2' -Class 'win32_OperatingSystem'
$LastBoot = $os.converttodatetime($os.lastbootuptime)
$days = ((get-date)-$lastboot).Days

if ($days -ge 3) {
    #This sends a Broadcast Message to the asset and optionally logs the activity to the asset's Recent Activity section
    Broadcast-Message -Title "Message from C2 Technology" -Message "It's been at least 3 days since your last reboot, please restart your computer as preventative maintenance. Thank you!" -LogActivity "false"
}
1 Like

Works fine for me. The script must be set to Run as the user, not SYSTEM. Unfortunately this also means if the user isn’t logged in they won’t get the message.

1 Like