Counting Log Activity Based On Product Install

by Apr 3, 2012

In a previous tip you learned how to use Group-Object to analyze text-based log files.

Here's a refined snippet. It will count on which days your Windows box received the most updates:

Get-Content $env:windir\windowsupdate.log | 
  Where-Object { $_ -like '*successfully installed*' } |
  Group-Object { $_.SubString(0,10) } -NoElement |
  Sort-Object Count -Descending |
  Select-Object Count, Name

Twitter This Tip! ReTweet this Tip!