Get all updates installed on a Windows system

Windows patching is so much more complicated than Linux (yum install -y :)

Here is a script to list all applied patches on a Windows ssystem:

$Session = New-Object -ComObject "Microsoft.Update.Session"
$Searcher = $Session.CreateUpdateSearcher()
$FormatEnumerationLimit=-1
$historyCount = $Searcher.GetTotalHistoryCount()

$Searcher.QueryHistory(0, $historyCount) | Select-Object Title, Description, Date, @{name="Operation"; expression={switch($_.operation)
{

        1 {"Installation"}; 2 {"Uninstallation"}; 3 {"Other"}

}}} -ExpandProperty Title > C:/Temp/ListOfWindowsUpdates.txt