What It Does
The monitor alerts when the date it finds is more than MaxDays old.
In Windows Update history, the script counts successful installs with a cumulative, security, monthly rollup or security-only title. Previews do not reset the date. Definition updates and the malicious software removal tool are omitted from the history it lists. It compares that result with the newest dated Get-HotFix entry and uses the newer date. If neither source has a date, it counts from when Windows was installed.
The rows are up to five recent history entries, including failures and excluding ignored titles. If no history is available, the rows show up to five dated hotfixes instead.
Before You Run It
- Set MaxDays to your patch cycle plus a margin. The default of 35 suits a monthly cycle.
- A machine that alerts with recent failures in its history usually needs reset-windows-update rather than another try.
- Remember a machine that was off for a month will alert. That is the point.
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 20 seconds.
- Example answer: "Last patched 41 days ago (2026-10-06, KB5044284); limit 35"
- 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.
- MaxDays: Alert when the last successful update install is older than this many days. Whole number, 0 to 3650. Default 35. 0 alerts on any age (useful for testing).
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.