List Installed Updates

by Apr 14, 2010

Using Get-Hotfix is pretty convenient as it serves to list installed updates. Unfortunately, it is not very thorough as it doesn’t retrieve information about tons of minor updates. The complete list can be found in a file called windowsupdate.log, which is really a huge text log file.

You should check out how one line of PowerShell can parse this file and return the information as objects:

Get-Content $env:windir\windowsupdate.log -encoding utf8 |
Where-Object { $_ -like '*successfully installed*'} |
Foreach-Object {
$infos = $_.Split("`t" $result = @{};
$result.Date = [DateTime]$infos[6].Remove($infos[6].LastIndexOf(":" $result.Product = $infos[1].SubString($infos[1].LastIndexOf(":")+ New-Object PSobject -property $result

Twitter This Tip! ReTweet this Tip!