Windows – Get all installed patches, updates and hotfixes

By Saad Khamis

October 25, 2023

20369 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

AWS EC2 – Get all EC2 instances in all profiles and all regions

By Saad Khamis 15805 views November 27, 2023

Azure – Get Storage Account Lifecycle Management Policy Rules

By Saad Khamis 33949 views October 12, 2023

Azure – NSG Flow Logs Explorer

By Saad Khamis 24158 views June 23, 2023