Google

2011-02-28

Win7 Hotfixes

I came across a repository of Windows 7 hotfixes here. I do not recall exactly where I saw it but I also found a list of all Pre-SP2 (i.e. Post-SP1) hotfixes, that looked like this:


  • Windows6.1-KB2495523-x64
  • Windows6.1-KB2495655-x64
  • Windows6.1-KB2495786-x64
  • Windows6.1-KB2496290-x64
  • Windows6.1-KB2496820-x64
  • Windows6.1-KB2498993-x64
  • Windows6.1-KB2502789-x64

There was no description so, I created a simple Powershell script that attempts to scrape the title of relevant KB articles. It seems to work OK, so posting it here.

# Get-HotFixTitles
## I saved the file with a list of hotfixes in the current folder as hotfixes.txt
$no=gc .\hotfixes.txt |%{$null,$kbno,$null=$_ -split '-';$kbno} | %{$_ -replace 'KB',''}
$wc=New-Object System.Net.WebClient
$kb="http://support.microsoft.com/kb/"

$result = $no | % { 
            $url= $kb+$_
            $content=$wc.DownloadString($url)
            $regex=[RegEx]'<h1 class="title">(.*?)</h1>'
            $title=$regex.Matches($content) | % { $_.Groups[1].Value }            
            
            new-object PSObject -Property @{ 
                kb    = "KB"+$_
                url   = $url
                title = $title
            } 
            
        }
      $result |select kb,title| ft -a

###   or you may pipe the results to a csv if you prefer that
      $result |export-csv .\results.csv

I like dot sourcing when working with such stuff so I can slice and dice it further on the command line using the Custom Object I built:

. .\get-HotfixTitles



Then simply use $result. E.g.
$result | ?{$_ -match "GP"} |select kb,title | out-gridview
Post a Comment