Windows – Get all installed patches, updates and hotfixes

By Saad Khamis

October 25, 2023

36247 views

In this blog I will share one way to get all installed patches, updates and hotfixes on a local or a remote Windows workstation or server.

Introduction

There are multiple ways to check for installed patches, updates and hotfixes on a Windows systems. Most of these commands don’t list all installed patches and updates. Examples of these commands are:

  1. Get-HotFix Gets the hotfixes that are installed on local or remote computers.
  2. wmic qfe list
  3. Get-WmiObject -Class win32_quickfixengineering WMI class represents a small system-wide update, commonly referred to as a quick-fix engineering (QFE) update, applied to the current operating system.

In this blog I will share one way to get all installed patches, updates and hotfixes on a local or a remote Windows workstation or server.

PowerShell Cmdlets and Commands

  1. New-Object Creates an instance of a Microsoft .NET Framework or COM object. This will be used to connect to ‘Microsoft.Update.Session’.
  2. QueryHistory([in] BSTR criteria, [in] LONG startIndex, [in] LONG count) Synchronously queries the computer for the history of the update events.
  3. Add-Member Adds custom properties and methods to an instance of a PowerShell object.
  4. Invoke-Command Runs commands on local and remote computers.

Installed Patches and Updates on Local Computer

Note the addition of Product, Result, RevisionNumber and UpdateId properties.

Below is a script output sample.

Installed Patches and Updates on Remote Computer

We will first encapsulate the above code in a function then use Invoke-Command to run the function on a remote computer. Note, we control the number of events returned by using a function variable with a default value of 1000 events.

Below is a script output sample.

Conclusion

Did you find this blog easy to follow and helpful to you? Let me know in the comments below.

Disclaimer

Purpose of the code contained in blog is solely for learning and demo purposes. Author will not be held responsible for any failure or damages caused due to any other usage.

Comments

There's no comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts

List all AWS Certificate Manager certificates

By Saad Khamis 14075 views July 31, 2024

Get all AWS EBS snapshots across all profiles and regions

By Saad Khamis 18433 views June 26, 2024