10/5 のブログ「Windows Updateで KB2552343 が失敗したまま...(未解決)」関連記事を調べている過程で、MSN 相談箱の「更新履歴の表示を検索することはできますか?」を見つけた。
Windows Update 更新履歴のテキストファイルはC:\Windows\SoftwareDistribution\ReportingEvents.log にありますので、メモ帳で開いて検索することができます。
ご質問の例では、ms12-060 で検索するより、KBxxxxx で検索した方がいいと思います。 更新履歴表示は、確かにいっぱいありますが、失敗した日と、KB番号を頼りに見ていけば見つけやすいと思います。
「しめたッ!」、早速 TeraPad で開いてみたら、Tab で切られたテキスト形式であることが解った。Excel マクロを作ろう‥‥
■ ReportingEvents.log
更新履歴の表示 | ReportingEvents.log | 備考 | |
---|---|---|---|
件数 | |||
インストール日 | 〜 2013/10/05 |
〜 2013/10/06 |
logにインストール日に合わせると 更新履歴は 300件強になる。 |
「状態」の種類 | 失敗 |
Failure |
|
「重要度」の種類 | 推奨 オプション |
「重要度」に相当する列を見つけ られない...(下記参照) |
※「重要度」に相当する I 列と K 列の組み合わせ
列(I) | 小計 | 列(K) | 件数 |
---|---|---|---|
AutomaticUpdates | 694 | Content Download | 151 |
Content Install | 388 | ||
Software Synchronization | 155 | ||
AutomaticUpdatesWuApp | 24 | Content Download | 24 |
ChkWuDrv | 16 | Content Download | 1 |
Software Synchronization | 15 | ||
EAIME | 29 | Content Download | 3 |
Content Install | 3 | ||
Software Synchronization | 23 | ||
Microsoft Security Essentials | 341 | Content Download | 113 |
Content Install | 114 | ||
Software Synchronization | 114 | ||
Office365DesktopSetup | 10 | Content Download | 1 |
Content Install | 2 | ||
Software Synchronization | 7 | ||
総計 | 1114 | 1114 |
■ 今日の結論
- ReportingEvents.log は更新履歴に代わるものではなかった。
- インストール日の範囲が短い。
逆に言えば、この程度の期間内にチェックしなさい‥‥ と、言っているのかも知れない。 - 更新履歴以上の情報がある。
- インストール日の範囲が短い。
- 折角マクロまで作ったので、機あるごとに併用するとする。
コードとしては綺麗でないが... - 結果としては中途半端に終わった。
■ マクロ(VBA)抜粋
後日の参考にするために載せた。
-
- マクロの修整は殆ど行っていない。特に、Tab区切りテキストデータを取り込むところは...
- ブログ上で付け加えたコメントもある。
- Option Explicit
- Public Sub Auto_Open()
- On Error GoTo Err_Auto_Open
- Dim mbTitle As String
- Dim macBookName As String, macBookPath As String, newBookName As String
- 'Dim nameBookPath As Variant, nameBookName As String
- Dim i As Long, k As Long, SheetCTR As Long
- Dim lastCol As Long, lastRow As Long
- Dim strString As String
- 'Dim VARAns As Variant
- mbTitle = "Auto_Open/" & ThisWorkbook.Name
- macBookName = ThisWorkbook.Name
- macBookPath = ThisWorkbook.Path
- '新規ブックを開く
- Workbooks.Add
- newBookName = ActiveWorkbook.Name
- 'Sheet2 以降は削除する。
- SheetCTR = Sheets.Count
- Application.DisplayAlerts = False '警告を出さない。
- If SheetCTR > 1 Then
- For i = SheetCTR To 2 Step -1
- Sheets(i).Delete
- Next
- End If
- Application.DisplayAlerts = True
- 'ReportingEvents.log を取り込む
- With ActiveSheet.QueryTables.Add(Connection:="TEXT;C:\Windows\SoftwareDistribution\ReportingEvents.log" _
- , Destination:=Range("$A$1"))
- .Name = "ReportingEvents"
- .FieldNames = True
- .RowNumbers = False
- .FillAdjacentFormulas = False
- .PreserveFormatting = True
- .RefreshOnFileOpen = False
- .RefreshStyle = xlInsertDeleteCells
- .SavePassword = False
- .SaveData = True
- .AdjustColumnWidth = True
- .RefreshPeriod = 0
- .TextFilePromptOnRefresh = False
- .TextFilePlatform = 932
- .TextFileStartRow = 1
- .TextFileParseType = xlDelimited
- .TextFileTextQualifier = xlTextQualifierDoubleQuote
- .TextFileConsecutiveDelimiter = False
- .TextFileTabDelimiter = True
- .TextFileSemicolonDelimiter = False
- .TextFileCommaDelimiter = False
- .TextFileSpaceDelimiter = False
- ' .TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
- .TextFileTrailingMinusNumbers = True
- .Refresh BackgroundQuery:=False
- End With
- '右下のアドレス
- Range("A1").Select
- ActiveCell.SpecialCells(xlLastCell).Select
- lastCol = ActiveCell.Column
- lastRow = ActiveCell.Row
- '1行目が空か調べる。
- For i = 1 To lastCol
- If Cells(1, i) <> "" Then Stop
- Next
- '項目名を付ける。
- Range("A1") = "列(A)"
- Range("B1") = "インストール日"
- Range("C1") = "列(C)"
- Range("D1") = "列(D)"
- Range("E1") = "列(E)"
- Range("F1") = "列(F)"
- Range("G1") = "列(G)"
- Range("H1") = "列(H)"
- Range("I1") = "列(I)"
- Range("J1") = "状態"
- Range("K1") = "重要度"
- Range("L1") = "名前"
- 'B列を日付型に変更する。
- For i = 2 To lastRow
- strString = Cells(i, 2)
- k = InStrRev(strString, ":")
- If k = 20 Then Cells(i, 2) = Left(strString, 19)
- Next
- 'B列の書式設定
- Columns("B:B").Select
- Selection.NumberFormatLocal = "yyyy/mm/dd"
- '中央揃え
- Columns("B:B").Select
- With Selection
- .HorizontalAlignment = xlCenter
- .VerticalAlignment = xlCenter
- .WrapText = False
- End With
- Range("A1:L1").Select
- With Selection
- .HorizontalAlignment = xlCenter
- .VerticalAlignment = xlCenter
- .WrapText = False
- End With
- 'B列を最適幅にする。
- Columns("B:B").EntireColumn.AutoFit
- '項目行を塗りつぶし、格子線を引く。
- Range("A1:L1").Select
- With Selection.Interior
- .Pattern = xlSolid
- .PatternColorIndex = xlAutomatic
- .ThemeColor = xlThemeColorAccent5
- .TintAndShade = 0.799981688894314
- .PatternTintAndShade = 0
- End With
- Selection.Borders(xlDiagonalDown).LineStyle = xlNone
- Selection.Borders(xlDiagonalUp).LineStyle = xlNone
- With Selection.Borders(xlEdgeLeft)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlEdgeTop)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlEdgeBottom)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlEdgeRight)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlInsideVertical)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlInsideHorizontal)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- 'ウィンドウ枠の固定
- Range("C2").Select
- ActiveWindow.FreezePanes = True
- '列を非表示にする。
- Range("A1").Select
- Columns("A:A").Select
- Selection.EntireColumn.Hidden = True
- Columns("C:H").Select
- Selection.EntireColumn.Hidden = True
- 'Ctrl+Home
- Range("I2").Select
- Exit_Auto_Open:
- Exit Sub
- Err_Auto_Open:
- MsgBox Err.Number & "/" & Err.Description, vbCritical, mbTitle
- Resume Exit_Auto_Open
- End Sub
- Public Sub 再表示する()
- Columns("A:L").Select
- Selection.EntireColumn.Hidden = False
- Range("A1").Select
- End Sub