WindowsUpdate.log の文字化け対策

メモ:  Category:windows

Windows Update のログが文字化けしてしまうので読めるようにしていきます。

Windows Update ログを読めるように変換する

Windows Update のログを確認するには、PowerShell で Get-WindowsUpdateLog を実行します。

PS C:\> Get-WindowsUpdateLog

実行した結果は、デスクトップに「WindowsUpdate.Log」というテキストファイルが作成されるのですがエラーメッセージなどが文字化けしてしまいます。

2022/10/18 10:04:58.2436826 900   7224  IdleTimer       WU operation (CLegacyEventUploader::HandleEvents) started; operation # 1181; does use network; is at background priority
2022/10/18 10:04:58.2437368 900   7224  WebServices     Auto proxy settings for this web service call.
2022/10/18 10:04:58.2952709 900   7224  WebServices     WS error: 'http://www.hoge.net:8530/ReportingWebService/ReportingWebService.asmx' ????????????????????????????????????????????????
2022/10/18 10:04:58.2952721 900   7224  WebServices     WS error: ?????????? HTTP ?????????? '503 (0x1F7)' ?????????????? 'Service Unavailable' ??????????????
2022/10/18 10:04:58.2952729 900   7224  WebServices     WS error: ????????????????????????????????????????????
2022/10/18 10:04:58.2952756 900   7224  WebServices     *FAILED* [80244022] Web service call
2022/10/18 10:04:58.2952765 900   7224  WebServices     Current service auth scheme=0.
2022/10/18 10:04:58.2952771 900   7224  WebServices     Current Proxy auth scheme=0.0
2022/10/18 10:04:58.2955341 900   7224  IdleTimer       WU operation (CLegacyEventUploader::HandleEvents, operation # 1181) stopped; does use network; is at background priority

Windows Update のログは、 Windows\Logs\WindowsUpdate に etl というバイナリ形式で保存されているので netsh コマンドを使ってテキスト形式へ変換します。

netsh trace convert input="WindowsUpdateログファイル" output="出力先ファイル"

netsh コマンドを実行すると 2 バイト文字が正しく出力されます。

[0]0384.1C38::2022-10-18 09:56:58.170743900 [WUTraceLogging]WU operation (CLegacyEventUploader::HandleEvents) started; operation # 1180; does use network; is at background priority
[0]0384.1C38::2022-10-18 09:56:58.170822900 [WUTraceLogging]Auto proxy settings for this web service call.
[0]0384.1C38::2022-10-18 09:56:58.196785900 [WUTraceLogging]WS error: 'http://www.hoge.net:8530/ReportingWebService/ReportingWebService.asmx' のエンドポイントとの通信でエラーが発生しました。
[0]0384.1C38::2022-10-18 09:56:58.196787500 [WUTraceLogging]WS error: サーバーが HTTP 状態コード '503 (0x1F7)' およびテキスト 'Service Unavailable' を返しました。
[0]0384.1C38::2022-10-18 09:56:58.196788300 [WUTraceLogging]WS error: サービスが一時的に過負荷状態になっています。
[0]0384.1C38::2022-10-18 09:56:58.196791600 [WUTraceLogging]*FAILED* [80244022] Web service call
[0]0384.1C38::2022-10-18 09:56:58.196792500 [WUTraceLogging]Current service auth scheme=0.
[0]0384.1C38::2022-10-18 09:56:58.196793200 [WUTraceLogging]Current Proxy auth scheme=0.
[0]0384.1C38::2022-10-18 09:56:58.197070700 [WUTraceLogging]WU operation (CLegacyEventUploader::HandleEvents, operation # 1180) stopped; does use network; is at background priority

bluenote by BBB