VBSでセキュリティパッチが当たっているか調べる。

セキュリティパッチ「KBXXXXXX」が当たっているか調べてくださいとか言われるのだるい
です。コントロールパネルからプログラムの変更と削除を起動して一つずつ調べるのとか
もうだるすぎる。
なので手軽にできないかと調べていたらそれレジストリみれば出来るよとうことでこんな
ものを教えてもらった。

PatchChecker.vbs

' チェック対象のパッチ
dim pathList(2)
pathList(1) = "KB000000"
pathList(2) = "KB999999"


strHost = "."
Const HKLM = &H80000002

'アンインストール情報
'(「プログラムの追加と削除」に表示される)
'の入ったレジストリパス
Const strBaseKey = "Software\Microsoft\Windows\CurrentVersion\Uninstall\"

'レジストリのサブキーを取得するために、
'WMIのStdRegProvを使用する
Set objReg = GetObject("winmgmts://" & strHost & "/root/default:StdRegProv")

'レジストリパスから、サブキーを取得
objReg.EnumKey HKLM, strBaseKey, arrSubKeys


'サブキーを一つ一つ取り出して、
'プログラム名を表示する
For Each strSubKey In arrSubKeys
   intRet = objReg.GetStringValue(HKLM, strBaseKey & strSubKey, _
       "DisplayName", strValue)
   If intRet <> 0 Then
       intRet = objReg.GetStringValue(HKLM, strBaseKey & strSubKey, _
       "QuietDisplayName", strValue)
   End If
   If (strValue <> "") and (intRet = 0) Then
       for i = 1 to ubound(pathList) step 1
           if instr(strValue, pathList(i)) <> 0 then
               pathList(i) = ""
           end if
       next
   End If
Next

for i = 1 to ubound(pathList) step 1
   if pathList(i) <> "" then
       WScript.Echo pathList(i) & "のインストールなし"
   end if
next

WScript.echo "処理終了"

レジストリは便利です。