PowerShell: Get Last Installed Windows Update
Need to quickly check the most recently installed update on a machine - to confirm a patch went through, or as part of a troubleshooting check? This one-liner pulls just the latest entry from the update history.
Prerequisites:
- Privileges: None
- Module: Built-in, no import needed
Quick Command:
Get-HotFix | Select-Object Description, HotFixID, InstalledOn | Sort-Object InstalledOn -Descending | Select-Object -First 1
Example Output:
Description HotFixID InstalledOn
----------- -------- -----------
Update KB5095189 7/16/2026 12:00:00 AM
📦
Want all of them at once?
Get every free one-liner from this blog in a single downloadable bundle organized by category, each with full comment-based help. No more copy-pasting one at a time.
Get every free one-liner from this blog in a single downloadable bundle organized by category, each with full comment-based help. No more copy-pasting one at a time.
How It Works:
- Get-HotFix queries installed updates and patches on the system - it's built on the same underlying data as the Win32_QuickFixEngineering CIM class, just wrapped in a friendlier cmdlet.
- Select-Object Description, HotFixID, InstalledOn trims the output down to just these three properties, since Get-HotFix also returns things like Source (the machine name) and InstalledBy (often blank).
- Sort-Object InstalledOn -Descending orders the list from most recently installed to oldest - this matters here, since without -Descending the sort defaults to ascending order, and grabbing the "first" result would return the oldest update instead of the latest one.
- Select-Object -First 1 trims the sorted list down to just that single most recent entry.