Every time I shut down or restart Windows 11, the installation of updates starts, and it always crashes and goes back to the original state... Furthermore, I can't use the DISM command to clean up components (/startcomponentcleanup) but gets rejected with the message "Error: 0x800f0806 This operation could not be completed because there is a pending operation."
This time, we will explain the official Microsoft troubleshooting steps to get out of the "Windows Update infinite crash loop." To avoid typing errors on the black screen (command prompt),A surefire way to create an autorun file (batch file) in advanceI will introduce you.
What causes the error 0x800f0806 and crash loop?
This error occurs when the system is locked with a "process (pending.xml) that must be restarted to be completed." Even if you restart the system, the process fails and crashes, so the system remains "pending" and falls into an infinite loop where no new operations are accepted.
[Warning] Do not forcibly change access rights from a running Windows
If there is a pending process listed, run it from a normally running Windows C:\Windows\WinSxS You might be thinking, "Why not just open the folder and edit it directly?" However, this folder is strongly protected by a system permission called "TrustedInstaller." In the past, when I tried to forcibly change the permissions in my experiments, the system crashed completely and would not start up.
▼Click here for the record of the tragic experiment
Therefore, be sure to perform offline operations safely from the Windows Recovery Environment (WinRE).
[Preparation] Create a command autoexecution file (batch file)
The black screen of the recovery environment (WinRE) requires you to manually type long commands, and there is also the risk of encountering the error "Error: 0x800f082f" due to insufficient working space. To avoid this, create an automatic program that can be executed by double-clicking while Windows is running normally.
1. Open Notepad.
2. Copy the entire code below and paste it into Notepad.
(This code is a program that automatically finds the misaligned Windows drive, creates a working area to prevent errors, and then executes repair commands.)
@echo off
echo 実行中のドライブを取得しています...
set "WinDrive=%~d0"
echo Windowsドライブは [%WinDrive%] です。
echo.
echo スクラッチ領域を作成し、DISMコマンドを実行します...
mkdir %WinDrive%\Scratch
DISM /Image:%WinDrive%\ /Cleanup-Image /RevertPendingActions /ScratchDir:%WinDrive%\Scratch
echo.
echo 処理が完了しました。ウィンドウを閉じてPCを再起動してください。
pause
3. Click "File" > "Save As" from the menu.
4. Change "Files of type" to "All files (.)"
5. Enter the file name repair.bat I will.
6.[Important] Change "Encoding" next to the Save button to "ANSI". (Note: The default setting for Windows 11 Notepad is "UTF-8." If you do not change it to "ANSI," the Japanese characters will be garbled and a black screen will appear when you run the program.)
7. First, for ease of understanding, select "Desktop" from the menu on the left, save it, and close Notepad.
8. It's on your desktop repair.bat Right-click and "Copy".
9. Open File Explorer and open "This PC" > "Local Disk (C:)".
10. Right-click on an empty space on the C drive and select "Paste."
11. "Access to the target folder is denied" or "Administrator privileges are required to copy to this folder"If a warning screen appears,Click Continue.
12.The batch file is now located directly under the C drive.
Undo pending actions from the recovery environment
First, use the official Microsoft DISM command to cleanly roll back (cancel) any pending tasks.
1. From the Windows Start menu, hold down the Shift key on your keyboard and click Restart on the power icon.
2. When the blue screen (recovery environment) appears, open "Troubleshoot" > "Advanced options" > "Command Prompt".
3. When the black screen opens, find the drive letter of the drive containing Windows.
This is because the recovery environment may deviate from "C". dir C:\ (\is a half-width yen symbol¥) and press Enter. If "repair.bat" is there, that is the Windows drive. If you get the message "File not found,"dir D:\ , dir E:\ Please search by entering the following in order. (Here, we will assume that it is on the C drive.)
4.repair.bat Using the drive letter where you found it, type the following and press Enter:
C:\repair.bat
5. When the message "The operation completed successfully" appears, close the command prompt by clicking the × button in the upper right corner.
6. The "Choose an option" screen will appear, so select "Continue".
7. The message "Update in progress. Please keep your computer turned on" will be displayed, and after a while Windows will start up.
8. If there are no other issues, the "pending operations" will be canceled and the issue of updates starting to install every time you shut down or restart your computer will be resolved.
Solution 2: Manually reset the registry and pending.xml (last resort)
If Solution 1 still does not start (crashes), try the last resort officially recommended by Microsoft: manually deleting the flag and stopping the service.
① Rename pending.xml
- Open the recovery environment command prompt again and check the Windows drive (e.g. C drive).
- Run the following commands to rename and disable the pending file:
ren C:\Windows\WinSxS\pending.xml pending.old
② Delete the "pending flag" in the registry
1. In the command prompt regedit Type and press Enter to open the Registry Editor.
2.From the tree on the left HKEY_LOCAL_MACHINE Click to select it.
3. Click "File" > "Load Hive" from the menu.C:\Windows\System32\config\COMPONENTS Open.
4. You will be asked for the key name, so enter "Test" and click OK.
5.HKEY_LOCAL_MACHINE\Test Expand and click on the right pendingxmlidentifier If there is a value like this, right-click it and select "Delete."
6.HKEY_LOCAL_MACHINE\TestWith the selected item selected, click "File" > "Unload Hive" from the menu to close Test.
7. When asked "Do you want to unload this key and all subkeys?" click "Yes".

③ Disable automatic startup of TrustedInstaller
1.From the tree on the left HKEY_LOCAL_MACHINE Click to select it.
2. Click "File" > "Load Hive" and this time C:\Windows\System32\config\SYSTEM Open.
3. Enter "Test" again as the key name.
4.HKEY_LOCAL_MACHINE\Test\ControlSet001\Services\TrustedInstaller Expands to.
5. On the right Start Double-click the value, change the value data to "4" (Disabled), and click OK.
6.HKEY_LOCAL_MACHINE\TestWith the selected item selected, click "File" > "Unload Hive" from the menu to close Test.
7. When asked "Do you want to unload this key and all subkeys?" click "Yes".
8. After closing the Registry Editor and Command Prompt, the "Choose an option" screen will appear. Select "Continue".
Post-processing after exiting the loop
Once you have resolved the issue of updates starting to install every time Windows starts up, shuts down, or restarts, you will need to restore the "TrustedInstaller" service (Windows Modules Installer) that you temporarily stopped.
- Press the Windows key + R on your keyboard.
services.mscand run it. - Find "Windows Modules Installer" in the list of services.
- Check the "Startup type"If it is set to "Disabled," double-click it to open it, change it to "Manual," and press "OK."(If it has already returned to "Manual", you can close the screen without doing anything.)
- To prevent the error from recurring, we recommend clearing the update cache and resetting the component just to be safe.




















Comment: