PowerShell – How to get a list of all installed Windows Updates

Handy script to get a list of installed WindowsUpdates:

$Session = New-Object -ComObject "Microsoft.Update.Session"
$Searcher = $Session.CreateUpdateSearcher()
$historyCount = $Searcher.GetTotalHistoryCount()
$Searcher.QueryHistory(0, $historyCount) | Select-Object Date,@{name="Operation"; expression={switch($_.operation){1 {"Installation"}; 2 {"Uninstallation"}; 3 {"Other"}}}}, @{name="Status"; expression={switch($_.resultcode){1 {"In Progress"}; 2 {"Succeeded"}; 3 {"Succeeded With Errors"};4 {"Failed"}; 5 {"Aborted"} }}}, Title,  Description | Export-Csv -NoType "$Env:userprofile\Desktop\Windows Updates.csv" 

Results are saved to your Desktop: Windows Updates.csv

Leave a Reply

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

13 − 6 =

This site uses Akismet to reduce spam. Learn how your comment data is processed.