Powershell – How to report on Windows Updates for a server over a yearly Period

For auditing purposes you will need to report on the updates install on a server and the install status. 

Below is a  powershell script that does just that

$operation=@(‘Unk’,’Installation’,’Uninstallation’,’Other’)
$resultCode=@(‘Unk’,’In Progress’,’Succeeded’,’Succeeded With Errors’,’Failed’,’Aborted’)

$updateSession=New-Object -ComObject Microsoft.Update.Session
$updateSearcher=$updateSession.CreateUpdateSearcher()
$historyCount=$updateSearcher.GetTotalHistoryCount()
$updateSearcher.QueryHistory(0, $historyCount) |
Select-Object Date,
@{N=’Operation’;E={$operation[$_.operation]}},
@{N=’Status’;E={$resultCode[$_.resultcode]}},
Title |
Format-Table -AutoSize
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...