|
| 1 | +--- |
| 2 | +title: Troubleshoot Windows Update Error 0x80070002 |
| 3 | +description: Learn how to resolve the Windows Update error 0x80070002, which occurs due to missing or corrupt files or incomplete updates. |
| 4 | +ms.date: 04/16/2025 |
| 5 | +manager: dcscontentpm |
| 6 | +audience: itpro |
| 7 | +ms.topic: troubleshooting |
| 8 | +ms.reviewer: scotro,mwesley |
| 9 | +ms.custom: |
| 10 | +- sap:windows servicing,updates and features on demand\windows update fails - installation stops with error |
| 11 | +- pcy:WinComm Devices Deploy |
| 12 | +--- |
| 13 | +# Troubleshoot Windows Update error 0x80070002 |
| 14 | + |
| 15 | +The Windows Update error 0x80070002 typically occurs because of missing or corrupt files necessary for the update or incomplete previous updates. Understanding the root causes and following the appropriate troubleshooting steps can help resolve this issue effectively. |
| 16 | + |
| 17 | +:::image type="content" source="./media/troubleshoot-windows-update-error-0x80070002/wusa-error-0x80070002.png" alt-text="Screenshot showing the Windows Update error 0x80070002."::: |
| 18 | + |
| 19 | +## Prerequisites |
| 20 | + |
| 21 | +Before proceeding with the troubleshooting steps, ensure you have backed up your operating system (OS) disk. This precautionary step is crucial to prevent data loss during the resolution process. |
| 22 | + |
| 23 | +## Root cause |
| 24 | + |
| 25 | +The error 0x80070002 is primarily caused by missing or corrupt files that are necessary for the update process. This issue can occur due to: |
| 26 | + |
| 27 | +- Incomplete previous updates that left the system in an inconsistent state. |
| 28 | +- Missing DLLs or system files in critical directories. |
| 29 | +- Registry entries pointing to nonexistent services or files. |
| 30 | + |
| 31 | +## CBS logs |
| 32 | + |
| 33 | +When troubleshooting Windows Update issues, CBS logs are helpful for identifying the root cause. |
| 34 | + |
| 35 | +The CBS log is located at `C:\Windows\Logs\CBS\CBS.log`. The log can roll over from CBS.log to CBSpersisttXXXXXXXXXXXXX.log or CBSpersisttXXXXXXXXXXXXX.cab within the same folder. |
| 36 | + |
| 37 | +## Symptom 1: Security monthly rollup installation failure |
| 38 | + |
| 39 | +If the Security Monthly Rollup fails to install with error 0x80070002, check the CBS logs. You might find entries indicating missing files or services that failed to start. |
| 40 | + |
| 41 | +```output |
| 42 | +Info CSI 000000fb Begin executing advanced installer phase 50 (0x00000032) index 0 (sequence 0) |
| 43 | +Error CSI 000000fc@2018/9/29:08:45:29.414 (F) Failed in StartService for [30]"clr_optimization_v4.0.30319_32" with error code 2[gle=0x80004005] |
| 44 | +Error CSI 000000fd (F) 80070002 [Warning,Facility=FACILITY_NTWIN32,Code=ERROR_FILE_NOT_FOUND] #17049# from Windows::COM::NgenOnlineServiceTickler(...)[gle=0x80070002] |
| 45 | +``` |
| 46 | + |
| 47 | +Check the directory `C:\Windows\Microsoft.NET\Framework\v4.0.30319` to confirm if it's empty. |
| 48 | + |
| 49 | +:::image type="content" source="./media/troubleshoot-windows-update-error-0x80070002/empty-directory-explorer.png" alt-text="Screenshot showing the empty directory in Windows Explorer." lightbox="./media/troubleshoot-windows-update-error-0x80070002/empty-directory-explorer.png"::: |
| 50 | + |
| 51 | +### Resolution: Registry key deletion |
| 52 | + |
| 53 | +[!INCLUDE [Registry alert](../../includes/registry-important-alert.md)] |
| 54 | + |
| 55 | +1. Navigate to the following registry locations: |
| 56 | + - `HKLM\System\CurrentControlSet\services\clr_optimization_v4.0.30319_32` |
| 57 | + - `HKLM\System\CurrentControlSet\services\clr_optimization_v4.0.30319_64` |
| 58 | + |
| 59 | + :::image type="content" source="./media/troubleshoot-windows-update-error-0x80070002/registry-keys-hklm.png" alt-text="Screenshot showing Registry keys for clr_optimization." lightbox="./media/troubleshoot-windows-update-error-0x80070002/registry-keys-hklm.png"::: |
| 60 | + |
| 61 | +2. Back up and delete these registry keys. |
| 62 | +3. Attempt to install the update again. |
| 63 | + |
| 64 | +## Symptom 2: Update installation failure |
| 65 | + |
| 66 | +If you encounter error 0x80070002 during update installation, review the CBS logs for entries like the following: |
| 67 | + |
| 68 | +```output |
| 69 | +Error CSI 00000e47 (F) STATUS_OBJECT_NAME_NOT_FOUND #13367681# from Windows::Rtl::SystemImplementation::DirectFileSystemProvider::SysCreateFile(flags = (AllowSharingViolation), handle = {provider=NULL, handle=0, name= ("null")}, da = (SYNCHRONIZE|FILE_READ_ATTRIBUTES), oa = @0xa130e9e088->OBJECT_ATTRIBUTES {s:48; rd:NULL; on:[69]"\??\C:\ProgramData\Microsoft\Windows\Start Menu\Programs\System Tools"; a:(OBJ_CASE_INSENSITIVE)}, iosb = @0xa130e9e068, as = (null), fa = 0, sa = (FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE), cd = FILE_OPEN, co = (FILE_SYNCHRONOUS_IO_NONALERT|0x00004000), eab = NULL, eal = 0, disp = Invalid) |
| 70 | +``` |
| 71 | + |
| 72 | +Verify the existence of the folder `C:\ProgramData\Microsoft\Windows\Start Menu\Programs\System Tools`. |
| 73 | + |
| 74 | +### Resolution: Copy missing folders |
| 75 | + |
| 76 | +Copy the **System Tools** folder from a working machine to the affected machine, ensuring all shortcuts are included. |
| 77 | + |
| 78 | +## Symptom 3: Missing DLLs in C:\Windows\WinSxS |
| 79 | + |
| 80 | +Monthly rollups might fail with error 0x80070002 due to missing DLLs in the Side-by-Side store. Check the **WindowsUpdate.log** and CBS logs for missing files like `DWrite.dll`. |
| 81 | + |
| 82 | +```output |
| 83 | +Info CBS Failed to find file: x86_microsoft-windows-directwrite_31bf3856ad364e35_7.1.7601.23545_none_229deeb1ba2a85d3DWrite.dll [HRESULT = 0x80070002 - ERROR_FILE_NOT_FOUND] |
| 84 | +``` |
| 85 | + |
| 86 | +### Resolution: Restore missing DLLs |
| 87 | + |
| 88 | +1. Identify missing DLLs from the CBS logs. |
| 89 | +2. Source these files from a working server and place them in the correct directories. To do so, run the following commands: |
| 90 | + |
| 91 | + ```console |
| 92 | + takeown /f c:\windows\winsxs |
| 93 | + icacls c:\windows\winsxs /grant administrators:F |
| 94 | + cd c:\windows\winsxs |
| 95 | + ``` |
| 96 | + |
| 97 | + Run the `mkdir` command to create a folder for the missing DLL file, and then copy the missing files to the folder. |
| 98 | + |
| 99 | + For example, assume that the file **x86_microsoft-windows-directwrite_31bf3856ad364e35_7.1.7601.23545_none_229deeb1ba2a85d3DWrite.dll** is missing. You can copy the file from a working server to `c:\windows\temp\dwrite.dll`, and then, run the following command: |
| 100 | + |
| 101 | + ```console |
| 102 | + mkdir x86_microsoft-windows-directwrite_31bf3856ad364e35_7.1.7601.23545_none_c67f532e01cd149d |
| 103 | + copy c:\windows\temp\dwrite.dll c:\windows\winsxs\x86_microsoft-windows-directwrite_31bf3856ad364e35_7.1.7601.23545_none_c67f532e01cd149d |
| 104 | + ``` |
| 105 | + |
| 106 | +3. Run the following command to check for corruptions: |
| 107 | + |
| 108 | + ```console |
| 109 | + DISM.exe /Online /Cleanup-image /Restorehealth |
| 110 | + ``` |
| 111 | + |
| 112 | +4. Download and install the standalone package for the Monthly Rollup from the [Microsoft Update Catalog](https://www.catalog.update.microsoft.com/Home.aspx). |
| 113 | + |
| 114 | +## Symptom 4: Cumulative update rollback |
| 115 | + |
| 116 | +If a cumulative update on Windows Server rolls back after a restart, check the Event Viewer for error 0x80070002 and review the CBS logs for driver update issues. |
| 117 | + |
| 118 | +Here's a sample of the event log: |
| 119 | + |
| 120 | +```output |
| 121 | +Log Name: System |
| 122 | +Source: Microsoft-Windows-WindowsUpdateClient |
| 123 | +Date: DD/MM/yyyy hh:ss:ff |
| 124 | +Event ID: 20 |
| 125 | +Task Category: Windows Update Agent |
| 126 | +Level: Error |
| 127 | +Keywords: Installation,Installation |
| 128 | +User: SYSTEM |
| 129 | +Computer: <ComputerName> |
| 130 | +Description: |
| 131 | +Installation Failure: Windows failed to install the following update with error 0x80070002: Security Update for Windows (KB4586793). |
| 132 | +``` |
| 133 | + |
| 134 | +The failure is caused by an issue during update drivers operation. For example, the following entries in the CBS logs indicates the `flpydisk.inf` driver is the cause: |
| 135 | + |
| 136 | +```output |
| 137 | +Info CBS INSTALL index: 55, phase: 2, result 2, inf: flpydisk.inf |
| 138 | +Info CBS Doqe: Failed installing driver updates [HRESULT = 0x80070002 - ERROR_FILE_NOT_FOUND] |
| 139 | +``` |
| 140 | + |
| 141 | +### Resolution: Import registry keys |
| 142 | + |
| 143 | +To fix the issue, you need to export the registry keys for the driver on a working computer, and then import them on the computer with the issue. |
| 144 | + |
| 145 | +The resolution depends on what is missing. For example, to fix the issue with `flpydisk.inf`, which is listed as an example in the symptom section, export and import the following two registry keys. |
| 146 | + |
| 147 | +- `HKLM\System\CurrentControlSet\Services\flpydisk` |
| 148 | +- `HKLM\System\CurrentControlSet\Services\sfloppy` |
| 149 | + |
| 150 | +## Symptom 5: Windows upgrade failure |
| 151 | + |
| 152 | +For Windows upgrade failures with error 0x80070002, examine the **Setupact.log** file for issues related to mounting WIM files. |
| 153 | + |
| 154 | +```output |
| 155 | +Warning SP Failed to get WimMount ImagePath, 0x80070002 |
| 156 | +Error SP CMountWIM::DoExecute: Failed to mount WIM file C:\$WINDOWS.~BT\Sources\SafeOS\winre.wim. Error 0xC1420121[gle=0xc1420121] |
| 157 | +``` |
| 158 | + |
| 159 | +### Resolution: Restore WIMMOUNT.sys |
| 160 | + |
| 161 | +Export WIMMOUNT.sys from registry: `HKLM\System\CCS\Services\Wimmount.sys` from the working server and merge it on the affected server. Then, merge them on the affected server. |
| 162 | + |
| 163 | +## Next steps |
| 164 | + |
| 165 | +After resolving the issue, ensure that your system is up to date with the latest updates and patches. Regularly check for updates to prevent similar issues in the future. |
0 commit comments