What It Does
The script is read-only. It answers is this fix on the machine two ways, and you can use either or both.
KBs is a list of update numbers such as KB5044284. A KB counts as installed when any of these shows it: Get-HotFix; the Windows Update history, where its newest successful entry for that KB must be an install and not an uninstall; or the Windows servicing store, the registry packages that cumulative updates leave, which Get-HotFix often misses. A package that a newer update superseded counts as covered. Each KB is one row saying which source saw it.
MinimumBuild is the first safe Windows build as build.revision, for example 26100.4351. The script reads the build and the update revision from the registry and alerts when the PC is below it. The script compares the build numerically, then the revision when the build matches. Give a minimum for the Windows release you run. A higher build passes this comparison but does not prove that fixes for another release are installed.
Check cumulative updates, the monthly rollups, with MinimumBuild, not KBs: once a newer cumulative update replaces an older one, the older KB may no longer show in any source, so a fully patched PC could read as missing. KBs suits one-off fixes such as .NET or Office security updates and out-of-band updates.
Before You Run It
- Use MinimumBuild for monthly cumulative updates, and KBs for one-off fixes.
- Give MinimumBuild for the Windows release you actually run. Group mixed releases separately when checking patch levels.
- Set KBs, MinimumBuild or both. The script returns an error if neither is set.
- Schedule it in your RMM and alert on exit 1.
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 30 seconds.
- Example answer: "Missing KB5044284; build 26100.3194 is below 26100.4351"
- 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.
- KBs: Update numbers, comma or semicolon separated, with or without the KB prefix: KB5044284,KB5043145. Set KBs, MinimumBuild or both. Default empty.
- MinimumBuild: The lowest acceptable build.revision, for example 26100.4351. Default empty.
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.