如何在 Windows 11 中重設 Windows 更新

如何在 Windows 11 中重設 Windows 更新

本指南將向您展示如何在Windows 11中將 Windows 更新元件和政策完全重設為預設值。

Windows Update 透過自動下載和​​安裝 Microsoft 發佈的最新更新、驅動程式和修復程式來讓 Windows 11 保持最新狀態。

有時您可能會遇到 Windows Update 問題,例如無法下載或安裝更新、錯誤訊息、無法搜尋新更新、掛起的更新問題等。當 Windows Update 資料庫或元件被停用時,可能會出現這些問題。損壞、一項或多項與Windows 更新相關的服務未運作等。

重設 Windows 更新元件通常可以解決這些類型的問題。

以下是在 Windows 11 中重設 Windows 更新的方法:

1. 下載下面的.bat 檔案。

Reset_Reregister_Windows_Update_Components_for_Windows11.bat

BAT文件內容參考:

Code:
@echo off

:: Prompt to Run as administrator
Set "Variable=0" & if exist "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs"
fsutil dirty query %systemdrive%  >nul 2>&1 && goto :(Privileges_got)
If "%1"=="%Variable%" (echo. &echo. Please right-click on the file and select &echo. "Run as administrator". &echo. Press any key to exit. &pause>nul 2>&1& exit)
cmd /u /c echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "%~0", "%Variable%", "", "runas", 1 > "%temp%\getadmin.vbs"&cscript //nologo "%temp%\getadmin.vbs" & exit
:(Privileges_got)

:: Checking and Stopping the Windows Update services
set b=0

:bits
set /a b=%b%+1
if %b% equ 3 (
   goto end1
)
net stop bits
echo Checking the bits service status.
sc query bits | findstr /I /C:"STOPPED"
if not %errorlevel%==0 (
    goto bits
)
goto loop2

:end1
cls
echo.
echo Cannot reset Windows Update since "Background Intelligent Transfer Service" (bits) service failed to stop. Please restart the computer, and try again.
echo.
pause
goto Start


:loop2
set w=0

:wuauserv
set /a w=%w%+1
if %w% equ 3 (
   goto end2
)
net stop wuauserv
echo Checking the wuauserv service status.
sc query wuauserv | findstr /I /C:"STOPPED"
if not %errorlevel%==0 (
    goto wuauserv
)
goto loop3

:end2
cls
echo.
echo Cannot reset Windows Update since "Windows Update" (wuauserv) service failed to stop. Please restart the computer, and try again.
echo.
pause
goto Start



:loop3
set c=0

:cryptsvc
set /a c=%c%+1
if %c% equ 3 (
   goto end4
)
net stop cryptsvc
echo Checking the cryptsvc service status.
sc query cryptsvc | findstr /I /C:"STOPPED"
if not %errorlevel%==0 (
    goto cryptsvc
)
goto Reset

:end4
cls
echo.
echo Cannot reset Windows Update since "Cryptographic Services" (cryptsvc) service failed to stop. Please restart the computer, and try again.
echo.
pause
goto Start


:Reset
Ipconfig /flushdns
del /s /q /f "%ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\qmgr*.dat"
del /s /q /f "%ALLUSERSPROFILE%\Microsoft\Network\Downloader\qmgr*.dat"
del /s /q /f "%SYSTEMROOT%\Logs\WindowsUpdate\*"


if exist "%SYSTEMROOT%\winsxs\pending.xml.bak" del /s /q /f "%SYSTEMROOT%\winsxs\pending.xml.bak"
if exist "%SYSTEMROOT%\winsxs\pending.xml" (
    takeown /f "%SYSTEMROOT%\winsxs\pending.xml"
    attrib -r -s -h /s /d "%SYSTEMROOT%\winsxs\pending.xml"
    ren "%SYSTEMROOT%\winsxs\pending.xml" pending.xml.bak
)
 
if exist "%SYSTEMROOT%\SoftwareDistribution\DataStore.bak" rmdir /s /q "%SYSTEMROOT%\SoftwareDistribution\DataStore.bak"
if exist "%SYSTEMROOT%\SoftwareDistribution\DataStore" (
    attrib -r -s -h /s /d "%SYSTEMROOT%\SoftwareDistribution\DataStore"
    ren "%SYSTEMROOT%\SoftwareDistribution\DataStore" DataStore.bak
)

if exist "%SYSTEMROOT%\SoftwareDistribution\Download.bak" rmdir /s /q "%SYSTEMROOT%\SoftwareDistribution\Download.bak"
if exist "%SYSTEMROOT%\SoftwareDistribution\Download" (
    attrib -r -s -h /s /d "%SYSTEMROOT%\SoftwareDistribution\Download"
    ren "%SYSTEMROOT%\SoftwareDistribution\Download" Download.bak
)
 
if exist "%SYSTEMROOT%\system32\Catroot2.bak" rmdir /s /q "%SYSTEMROOT%\system32\Catroot2.bak"
if exist "%SYSTEMROOT%\system32\Catroot2" (
    attrib -r -s -h /s /d "%SYSTEMROOT%\system32\Catroot2"
    ren "%SYSTEMROOT%\system32\Catroot2" Catroot2.bak
)
 

:: Reset Windows Update policies
reg delete "HKCU\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /f
reg delete "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\WindowsUpdate" /f
reg delete "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /f
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\WindowsUpdate" /f
gpupdate /force


:: Reset the BITS service and the Windows Update service to the default security descriptor
sc.exe sdset bits D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)
sc.exe sdset wuauserv D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)


:: Reregister the BITS files and the Windows Update files
cd /d %windir%\system32
regsvr32.exe /s atl.dll
regsvr32.exe /s urlmon.dll
regsvr32.exe /s mshtml.dll
regsvr32.exe /s shdocvw.dll
regsvr32.exe /s browseui.dll
regsvr32.exe /s jscript.dll
regsvr32.exe /s vbscript.dll
regsvr32.exe /s scrrun.dll
regsvr32.exe /s msxml.dll
regsvr32.exe /s msxml3.dll
regsvr32.exe /s msxml6.dll
regsvr32.exe /s actxprxy.dll
regsvr32.exe /s softpub.dll
regsvr32.exe /s wintrust.dll
regsvr32.exe /s dssenh.dll
regsvr32.exe /s rsaenh.dll
regsvr32.exe /s gpkcsp.dll
regsvr32.exe /s sccbase.dll
regsvr32.exe /s slbcsp.dll
regsvr32.exe /s cryptdlg.dll
regsvr32.exe /s oleaut32.dll
regsvr32.exe /s ole32.dll
regsvr32.exe /s shell32.dll
regsvr32.exe /s initpki.dll
regsvr32.exe /s wuapi.dll
regsvr32.exe /s wuaueng.dll
regsvr32.exe /s wuaueng1.dll
regsvr32.exe /s wucltui.dll
regsvr32.exe /s wups.dll
regsvr32.exe /s wups2.dll
regsvr32.exe /s wuweb.dll
regsvr32.exe /s qmgr.dll
regsvr32.exe /s qmgrprxy.dll
regsvr32.exe /s wucltux.dll
regsvr32.exe /s muweb.dll
regsvr32.exe /s wuwebv.dll
netsh winsock reset
netsh winsock reset proxy

:: Set the startup type as automatic
sc config wuauserv start= auto
sc config bits start= auto
sc config DcomLaunch start= auto

:Start
net start bits
net start wuauserv
net start cryptsvc

:: Restart computer
cls
echo It is required to restart the computer to finish resetting Windows Update.
echo.
echo Please save and close anything open now, before the computer is restarted.
echo.
pause
echo.
echo.
echo.
echo *** Restart computer now. ***
echo.
pause
shutdown /r /f /t 0

2. 將 .bat 檔案儲存到桌面。

3. 解除阻止.bat 檔案。

4. 運行.bat 檔案。

5. 如果出現 UAC 提示,請按一下是以核准以管理員權限執行。

6. Windows 更新重設程序完成後,系統會提示您“在電腦重新啟動之前,請儲存並關閉現在開啟的所有內容。”準備好後按任意鍵繼續。

注意:如果服務在 3 次嘗試後未能停止,.bat 檔案將自動結束,並顯示訊息「無法重設 Windows 更新」並提示按任意鍵繼續。

按下某個鍵時,.bat 檔案將重新啟動在關閉命令提示字元之前停止的所有服務。

7. 現在,系統將提示您按任意鍵立即重新啟動電腦。

注意:這將立即重新啟動您的計算機,因此請在繼續之前儲存並關閉所有開啟的內容。

運行 .bat 檔案後立即重新啟動電腦以應用它而不打開任何其他內容非常重要。

如何在 Windows 11 中重設 Windows 更新

重新啟動電腦以應用更改


如何在 Windows 中變更無線網路介面卡的首選頻段

如何在 Windows 中變更無線網路介面卡的首選頻段

本指南將向您展示如何變更 Windows 7、Windows 8 和 Windows 10 中無線網路介面卡預設使用的首選頻段(至 5GHz 或 2.4GHz)。

什麼是處理器親和性?如何在 Windows 10 上設定處理器關聯性

什麼是處理器親和性?如何在 Windows 10 上設定處理器關聯性

但是,可以將程式設定為僅使用 1 個或 2 個核心而不是所有核心。在這篇文章中,Quantrimang.com 將解釋什麼是處理器關聯性以及如何在 Windows 10 上設定處理器關聯性。

應避免使用隱私保護最差的 VPN

應避免使用隱私保護最差的 VPN

VPN 技術的日益普及引發了各種範圍、方法和大膽程度各異的詐騙。

如何在 Windows 10 上遠端鎖定電腦

如何在 Windows 10 上遠端鎖定電腦

Windows 10 有一個巧妙的功能,不僅可以讓您追蹤您的設備,還可以遠端鎖定它。

如何使用 SpyHunter 刪除間諜軟體並防止鍵盤記錄程序

如何使用 SpyHunter 刪除間諜軟體並防止鍵盤記錄程序

SpyHunter 是一款搜尋並銷毀電腦上的惡意軟體、間諜軟體和反鍵盤記錄程式的軟體。

嘗試 Windows 10 上的新硬碟容量分析工具“磁碟使用情況”

嘗試 Windows 10 上的新硬碟容量分析工具“磁碟使用情況”

磁碟使用情況位於C:\Windows\System32\diskusage.exe,輸入diskusage /?時會顯示使用說明。該實用程式可以掃描整個磁碟機或指定資料夾並報告每個資料夾的使用量。

如何在Windows 10/11上安裝月光騎士主題

如何在Windows 10/11上安裝月光騎士主題

月光騎士主題套裝品質非常高,值得您立即安裝到您的電腦上。

使用「執行」命令快速開啟 Windows 應用程式的說明

使用「執行」命令快速開啟 Windows 應用程式的說明

當我們需要在Windows中快速開啟應用程式時,我們經常使用鍵盤快捷鍵。然而很少人知道還有一種方法,那就是使用Run指令。運行中有很多命令可以在 Windows 中打開不同的應用程序,但最常見的是下面 5 個打開應用程式的命令。請參考。

您的 Windows 10 電腦有病毒,修復方法如下

您的 Windows 10 電腦有病毒,修復方法如下

當惡意程式碼自行安裝到您的電腦上時,它們可以快速控制您的電腦並導致極其嚴重的錯誤。即使您下載和安裝的防毒軟體有時也可能是假冒軟體,這可能會損害您的電腦。

使用 Ubuntu Live USB 從 Windows PC 移除病毒

使用 Ubuntu Live USB 從 Windows PC 移除病毒

您的 Windows 電腦感染了病毒,或更糟的是,您甚至無法啟動它。如果您擁有 Ubuntu Live USB 或 CD,則可以使用它來清理您的 PC 並嘗試還原 Windows。