Sometimes when trying to find particular updates and troubleshoot Windows update problems you need to be able to manipulate the update data. Using the ‘installed updates’ applet is not always practical. I use the below script to give me a .csv files with all updates installed on a machine.
$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 "c:\temp\WindowsUpdates.csv" -NoTypeInformation
very helpful. Thank you!
Anyway to run this against a list
Hi It would be help for run this for multiple servers with output includes the pscomputer name if possible. Thank you.