goguppy.com ← scripts and remediations

🔄 Reboot Reminder

Intune Remediation · Prompts the user when uptime hits 7 days
Nothing reboots on its own. The user gets a popup and reboots on their own schedule, so nobody loses work. Detection exits 1 to trigger remediation, 0 to stay put.
Detection Script
D
Detect uptime of 7 days or more detection
Exits 1 (non-compliant) to trigger remediation. Exits 0 if clean.
›
$up = (Get-Date) - (Get-CimInstance Win32_OperatingSystem).LastBootUpTime if ($up.Days -ge 7) { exit 1 } else { exit 0 }
Remediation Script
R
Pop up a reboot reminder remediation
Runs only when detection exits 1. Nothing is forced, the user reboots when ready.
›
(New-Object -ComObject Wscript.Shell).Popup("Your device needs a reboot. Please make sure everything is saved and reboot at your earliest convenience.", 900, "Reboot required", 0+48) > $null exit 0
The popup dismisses itself after 15 minutes if nobody clicks OK. Detection keeps flagging the device on every run until it actually reboots, so the reminder comes back daily.
Intune Remediation Settings
Run this script using the logged on credentials Yes
Enforce script signature check No
Run script in 64-bit PowerShell host Yes
Schedule (recommended) Daily