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

 

[email protected]('Unk','Installation','Uninstallation','Other')
[email protected]('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
VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Tags: audit, list, powershell, Windows Update, year

Trackback from your site.