KB5007651 が何度も再オファーされる事象へのトラブルシューティング

Published: feedback 共有

本記事では、Windows セキュリティアプリの更新プログラムである KB5007651 が繰り返し配信され、正常にインストールできない事象についての対処方法をご案内しております。

本記事の内容

事象の概要

一部の環境において、KB5007651 が正常にインストールされず、Windows セキュリティアプリのバージョンが最新に更新されない事象を確認しております。
本事象では、KB5007651 の更新が繰り返し試行された出力が Windows Update に記録される特徴がございます。

問題の発生画面

問題の発生原因

本事象は、何らかの理由により残存していた古い “SecurityHealthSetup.exe” が原因で、KB5007651 の更新時に「HKLM\SOFTWARE\Microsoft\Windows Security Health\Updates」パス内の “wu” レジストリ値が正しく更新されず、”CopyError” として判定されることに起因します。

問題の解決方法

本事象の対処には、”SecurityHealthSetup.exe” の削除と、一部レジストリ値の修正が必要です。

問題の解消のためには以下の手順をご実施ください。

  1. 以下の PowerShell スクリプトを ResetWsa.ps1 などのファイル名で保存したファイルを C:\Temp フォルダに保存します。

※ “C:\Temp” が存在しない場合には事前に作成いただきますようお願いいたします。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

$env:TempDir = "$env:TEMP\PsExec"

# Ensure PsExec is downloaded and available in the temporary directory
$psExecPath = "$env:TempDir\psexec.exe"
Write-Host "Downloading PsExec..."
$psExecUrl = "https://download.sysinternals.com/files/PSTools.zip"
$zipPath = "$env:TEMP\PSTools.zip"
$extractPath = "$env:TEMP\PSTools"
Invoke-WebRequest -Uri $psExecUrl -OutFile $zipPath
Write-Host "Extracting PsExec..."
Expand-Archive -Path $zipPath -DestinationPath $extractPath
Write-Host "Copying PsExec to temporary directory..."
New-Item -ItemType Directory -Path $env:TempDir -Force
Copy-Item -Path "$extractPath\PsExec.exe" -Destination $env:TempDir
Write-Host "Cleaning up temporary files..."
Remove-Item -Path $zipPath, $extractPath -Recurse

# Run command prompt with system privileges and delete SecurityHealthSetup.exe silently
Write-Host "Deleting SecurityHealthSetup.exe..."
Start-Process -FilePath $psExecPath -ArgumentList "-s -accepteula -d cmd.exe /c del /f $env:windir\System32\SecurityHealth\SecurityHealthSetup.exe" -Wait

# Modify registry keys as System user
$regPath = "HKLM:\Software\Microsoft\Windows Security Health\Platform"
Write-Host "Setting 'Registered' registry key to 0..."
Start-Process -FilePath $psExecPath -ArgumentList "-s -accepteula -d powershell.exe -Command `"Set-ItemProperty -Path '$regPath' -Name 'Registered' -Value 0`"" -Wait
Write-Host "Setting 'CoreLocation' registry key to an empty string..."
Start-Process -FilePath $psExecPath -ArgumentList "-s -accepteula -d powershell.exe -Command `"Set-ItemProperty -Path '$regPath' -Name 'CoreLocation' -Value ''`"" -Wait

# Delete PsExec from the temporary directory
Write-Host "Deleting PsExec from temporary directory..."
Remove-Item -Path $psExecPath
Write-Host "PsExec has been deleted from the $env:TempDir folder."
  1. コマンドプロンプトを管理者権限で実行し、以下のコマンドを入力します。
1
PowerShell -ExecutionPolicy Bypass C:\Temp\ResetWsa.ps1

※ スクリプトの実行時にはインターネットから PSTools のダウンロードが行われ、問題の解消のために必要な設定変更が行われます。

  1. スクリプトの実行後、端末を再起動します。

  2. Windows Update を確認し、最新の KB5007651 を適用します。


なお、スクリプトの使用が難しい場合は、手動での対処も可能です。

以下の手順を参考に、”SecurityHealthSetup.exe” の削除、およびレジストリの修正をご実施ください。


<PsExec の準備>

本作業はシステム権限が必要となりますので、以下の手順に沿って PsExec を準備してから、後述の作業をご実施ください。

  1. 以下のページから、PsExec をダウンロードします。

PsExec v2.43: https://learn.microsoft.com/en-us/sysinternals/downloads/psexec

  1. ダウンロードしたファイルを解凍し、psexec.exe を C:\Windows\System32 フォルダにコピーします。
    ※ C:\Windows\System32 フォルダに保存することで、どのディレクトリからでも使用可能になります。

<SecurityHealthSetup.exe を削除する>

  1. コマンドプロンプトを管理者権限で実行します。

  2. 以下のコマンドを実行いただき、システム権限でコマンドプロンプトを開きます。

1
psexec -s -i cmd.exe
  1. 以下のコマンドで「SecurityHealthSetup.exe」ファイルを削除します。
1
del C:\Windows\System32\SecurityHealth\SecurityHealthSetup.exe

※ 万が一、”SecurityHealthSetup.exe” が削除されない場合には、”del /f C:\Windows\System32\SecurityHealth\SecurityHealthSetup.exe” で実行してください


<”Registered”、”CoreLocation” レジストリを変更する>

  1. コマンドプロンプトを管理者権限で実行します。
  2. 以下のコマンドにて、レジストリエディターを開きます。
1
psexec -s -i regedit.exe
  1. 以下のパスに移動します。

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Security Health\Platform

  1. 「Registered」キーを右クリックし、「修正 (Modify)」を選択します。

  2. 値を 1 から 0 に変更し、「OK」をクリックして変更を保存します。

  3. 「CoreLocation」キーを右クリックし、「修正 (Modify)」を選択します。

  4. 値を「\\?\C:\Windows\System32\SecurityHealth\1.0.2306.10002-0」などから、「\\?\C:\Windows\System32」に変更し、「OK」をクリックして変更を保存します。

  5. 端末を再起動します。