Skip to content
Menu

PC Never Rebooted - Uptime and Pending-Reboot Monitor

Alerts when uptime is over MaxUptimeDays or a restart is pending, and says why: servicing, Windows Update, a rename or Configuration Manager.

PC never rebooted - uptime and pending-reboot monitor is free for members.

Enter your email to create your free account and get the file.

We'll email you the script and the weekly MSP Outpost email. Unsubscribe anytime. Privacy policy.

Already a member? Sign in.

Be the first to review PC never rebooted - uptime and pending-reboot monitor. Tell other MSPs how it worked for you.

Write a Review

LanguagePowerShell
Runs onWindows 10, Windows 11, Windows Server 2016+; runs as SYSTEM or a user
NeedsPowerShell 5.1
Read-onlyReads, changes nothing

What It Does

The script reads the time of the last boot and these Windows restart signals: component servicing, Windows Update, queued file renames, the Configuration Manager client when its service is present, and a pending computer rename. It writes one row per check.

It alerts when uptime is over MaxUptimeDays, or when a restart is pending and AlertOnPendingReboot is true. Set AlertOnPendingReboot to false to watch uptime only.

Queued file renames are set permanently on many healthy PCs by antivirus and drivers, so they are listed but do not alert unless IncludeFileRenames is true. With Fast Startup on, Shut down does not reset the uptime clock, only Restart does, and the Fast Startup row says which applies.

Before You Run It

  • Agree a restart window with the client before you alert on it. This tells you who needs one; it never restarts.
  • Leave IncludeFileRenames off unless you have a reason. It makes healthy machines alert.
  • When users say they shut down every night and uptime says otherwise, the Fast Startup row explains it.

Type and Risk

  • Type: Monitor. It checks one condition. It exits 1 when it finds the problem, so your RMM can alert on it, 0 when all is well, and 2 when it could not run.
  • Risk: Low. It reads and changes nothing.
  • Restart: It never restarts the machine.
  • Typical run: Under 10 seconds.
  • Example answer: "Up 23 days (limit 14); reboot pending (Windows Update)"
  • Tested before listing on Windows 11 with Windows PowerShell 5.1, run as SYSTEM, against its own test cases.

Inputs

Pass an input as an argument (-Name value), as an environment variable with the same name, which is how most RMMs pass script variables, or change its default in the param() block at the top of the script. An argument wins over an environment variable, which wins over the default.

  • MaxUptimeDays: Alert when the PC has been up longer than this many days. Whole number, 0 to 3650. Default 14. 0 alerts on any uptime (useful for testing).
  • AlertOnPendingReboot: Alert when a restart is pending. true or false. Default true.
  • IncludeFileRenames: Also alert when file renames are queued for the next restart. true or false. Default false.

Every script also takes DryRun, OutputFormat (Text, Answer, Json or Csv), ExportPath and ResultField, which writes the answer to an RMM custom field.

License

Provided "as is" under the MIT License, without warranty of any kind. Test before production use. MSP Outpost and User First Digital Inc. accept no liability for any damage or loss.

The Script

test-pending-reboot.ps1 · 825 lines · 42.4 KB

Free for Members

Create a free account or sign in to read, copy and download this script.

Welcome Back

Sign in to your MSP Outpost account.