PowerShell Genie

Collect hotfix history

Script 2 min read Windows PowerShell 5.1 and PowerShell 7

Documentation: Microsoft Learn

Get-HotFix wraps the Win32_QuickFixEngineering class and returns one row per servicing update.

The script

1PS> Get-HotFix | Sort-Object InstalledOn -Descending | Select-Object -First 25 HotFixID,InstalledOn,Description

Script reader

Inspect before you run

Inspection only

Inspect the script below. It does not run in this browser.

Inspection only — no command has run.

    Show reference output
    1 Source Description HotFixID InstalledOn
    2 ------ --------------- --------- -----------
    3 SRV01 Security Update KB5039217 9/6/2026
    4 SRV01 Update KB5040442 8/28/2026
    Inspect this example’s structure

    Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.

    Get-HotFix | Sort-Object InstalledOn -Descending | Select-Object -First 25 HotFixID,InstalledOn,Description
    1. Stage 1Get-HotFixPositional values or no named parameters
    2. Stage 2Sort-Object-Descending
    3. Stage 3Select-Object-First

      How it works

      Get-HotFix wraps the Win32_QuickFixEngineering class and returns one row per servicing update. Sort-Object orders by InstalledOn newest first, and -First 25 keeps the recent history rather than everything applied since the image was built.

      Adapting it

      For a yes-or-no question about one update, drop the sort and trim entirely and use Where-Object HotFixID -eq 'KB5034129' instead.

      If the result is unexpected

      A KB the vendor insists is installed does not appear, or InstalledOn is blank for several rows so the sort places them in an arbitrary order.

      This class reports only what the servicing stack recorded as quick-fix engineering entries, which excludes driver updates, Store updates, and anything delivered as a feature upgrade. The InstalledOn value comes from a field some packages never populate, and sorting on a null puts those rows wherever the comparer happens to land them.

      1. Cross-check the Setup event log, which records what was installed and when it happened.
      2. Query update history through the Microsoft.Update.Session COM object for a fuller picture.
      3. Compare the OS build and revision against the level the KB is documented to produce.
      4. Drop rows where InstalledOn is null before sorting so the order becomes meaningful.
      5. Check whether the update was superseded, since a superseded KB legitimately vanishes from this view.

      Validate the result

      The build and revision on the machine match the level the KB is documented to produce, which settles the question whatever this listing shows.

      Keep the check reliable

      Report patch state from the OS build revision rather than a KB list, because a build number cannot be missing the way an inventory entry can.

      Primary documentation

      PowerShell objects and pipelines documentation

      Continue
      Genie guideCollect hotfix history

      Get-HotFix wraps the Win32_QuickFixEngineering class and returns one row per servicing update.