Listing Installed Updates (Part 1)

by Dec 24, 2019

Get-Hotfix only lists operating-system-related hotfixes:

Get-HotFix 

In reality, it is just a thin wrapper around a WMI query which produces identical results:

Get-CimInstance -ClassName Win32_QuickFixEngineering 

A quick and more complete way of dumping all installed updates is querying the System event log:

Get-WinEvent @{
  Logname='System'
  ID=19
  ProviderName='Microsoft-Windows-WindowsUpdateClient'
} | ForEach-Object  {
  [PSCustomObject]@{
    Time = $_.TimeCreated
    Update  = $_.Properties.Value[0]
  }
}

Obviously, when the System event log was cleared, the results are no longer complete. Also, the log simply logs any update installation, so over time new updates can replace older updates.

To guarantee you get a complete list of currently installed updates, you’d have to ask the Windows Update Client to re-construct the list from the actual installed updates which takes a lot longer:

$result = (New-Object -ComObject Microsoft.Update.Session).CreateupdateSearcher().Search("IsInstalled=1").Updates |
  Select-Object LastDeploymentChangeTime, Title, Description, MsrcSeverity 

$result | Out-GridView -Title 'Installed Updates'

You are a PowerShell Professional, passionate about improving your code and skills? You take security seriously and are always looking for the latest advice and guidance to make your code more secure and faster? You’d love to connect to the vibrant PowerShell community and get in touch with other PowerShell Professionals to share tricks and experience? Then PowerShell Conference EU 2020 might be just the right place for you: https://psconf.eu (June 2-5, 2020 in Hanover, Germany).

It’s a unique mixture of classic conference with three parallel tracks filled with fast-paced PowerShell presentations, and advanced learning class with live discussions, Q&A and plenty of networking.

Secure your seat while they last: https://psconf.eu/register.html. Help build the agenda and make this “your” event by submitting hypothetical sessions you’d like to hear: https://powershell.one/psconfeu/psconf.eu-2020/reverse-cfp. And if you’d like to present yourself and join the psconf.eu speakers’ team, submit proposals: https://sessionize.com/psconfeu/.

Twitter This Tip! ReTweet this Tip!