List Installed Updates

Share |

Join PowerShell.com!
Subscribe to Feed

PowerShell eBook
Sign up for
Your PowerTip of the Day:

Award-winning PowerShellPlus


Admin Guide to PowerShell Remoting


Mastering PowerShell eBook

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

Copyright 2012 PowerShell.com. All rights reserved.