List Installed Updates

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(":")+2);
New-Object PSobject -property $result
}

Twitter This Tip! ReTweet this Tip!


Posted Apr 14 2010, 08:00 AM by ps1

Comments

Twitter Trackbacks for List Installed Updates - Power Tips - PowerShell.com [powershell.com] on Topsy.com wrote Twitter Trackbacks for List Installed Updates - Power Tips - PowerShell.com [powershell.com] on Topsy.com
on 04-14-2010 10:17 AM

Pingback from  Twitter Trackbacks for                 List Installed Updates - Power Tips - PowerShell.com         [powershell.com]        on Topsy.com

Concentrated Tech NSoftware Dell Compellent Sponsored by Idera and Concentrated Tech and NSoftware and Dell Compellent
Copyright 2011 PowerShell.com. All rights reserved.