[玩转系统] 如何重置 Windows 更新组件以修复更新错误
作者:精品下载站 日期:2024-12-14 23:19:43 浏览:14 分类:玩电脑
如何重置 Windows 更新组件以修复更新错误
如果 Windows Update 服务无法正常工作,无法下载或安装更新,那么解决 Windows Update 服务问题的最简单、最有效的方法就是恢复其原始设置。在本文中,我们将向您展示如何重置 Windows 更新代理和服务配置。
通常,要调试 Windows Update 错误,管理员需要分析 %windir%\WindowsUpdate.log 文件中的错误代码(在 Windows 10 中,您可以通过这种方式获取 WindowsUpdate.log)。管理员在分析 Windows 更新日志时可能遇到的错误数量有几十个(Windows 更新错误的完整列表),并且解决这些错误的过程并不简单。为了避免不必要的努力并且不浪费时间,将 Windows Update 服务和代理完全重置为默认状态要容易得多。
使用 Windows 更新疑难解答修复更新问题
在继续重置 Windows 更新配置之前,我们强烈建议您首先尝试使用更简单且相当有效的工具,使用内置的Windows 更新疑难解答自动修复 Windows 更新服务中的问题。
Windows 更新疑难解答已内置于 Windows 10 和 11 的现代设置面板中。对于以前版本的 Windows,您必须手动下载:
-
Windows 11 — 设置 -> 系统 -> 疑难解答 -> 其他疑难解答 -> Windows 更新;
Windows 10 - wu10.diagcab (https://aka.ms/wudiag ) 或运行该工具的本地版本:开始 -> 设置 -> 更新和安全 -> 疑难解答 -> 其他疑难解答 -> Windows 更新(解决阻止您更新 Windows 的问题);
要快速访问 Windows 故障排除工具,您可以使用 ms-settings URI 命令:
ms-settings:troubleshoot
Windows 7 和 Windows 8.1 - WindowsUpdate.diagcab (https://aka.ms/diag_wu)。
等待 Windows 更新疑难解答程序扫描您的系统并尝试自动修复 Windows 更新和相关组件中的任何错误。
就我而言,发现并修复了 Windows 更新数据库中的损坏。之后,仍然需要重新启动计算机并尝试扫描更新。如果未下载或安装更新,请继续执行下一步。
使用 PowerShell 重置 Windows 更新客户端
您可以使用 PSWindowsUpdate PowerShell 模块重置 Windows Update 代理和服务。
从 PSGallery 脚本库在您的计算机上安装模块:
Install-Module -Name PSWindowsUpdate
启用 PowerShell 脚本的执行:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -force
运行命令:
Reset-WUComponents -verbose
Reset-WUComponents 命令停止服务、重新注册 DLL 并清理 C:\Windows\SoftwareDistribution 文件夹等。完整的操作日志可用。
VERBOSE: Background Intelligent Transfer Service (BITS)
VERBOSE: Windows Update (wuauserv)
VERBOSE: Application Identity (appidsvc)
VERBOSE: Cryptographic Services (cryptsvc)
Step 2: Delete the qmgr*.dat files
Step 3: Backup software distribution folders
VERBOSE: Renaming Software Distribution folder to C:\Windows\SoftwareDistribution.bak
VERBOSE: Renaming CatRoot folder to C:\Windows\System32\Catroot2.bak
Step 4: Remove old Windows Update logs
VERBOSE: Deleting the C:\Windows\WindowsUpdate.log files.
Step 5: Reset Windows Update services
VERBOSE: Reset BITS service
VERBOSE: Reset Windows Update service
Step 6: Reregister dll's
VERBOSE: regsvr32.exe / s atl.dll
VERBOSE: regsvr32.exe / s urlmon.dll
VERBOSE: regsvr32.exe / s mshtml.dll
VERBOSE: regsvr32.exe / s shdocvw.dll
VERBOSE: regsvr32.exe / s browseui.dll
VERBOSE: regsvr32.exe / s jscript.dll
VERBOSE: regsvr32.exe / s vbscript.dll
VERBOSE: regsvr32.exe / s scrrun.dll
VERBOSE: regsvr32.exe / s msxml.dll
VERBOSE: regsvr32.exe / s msxml3.dll
VERBOSE: regsvr32.exe / s msxml6.dll
VERBOSE: regsvr32.exe / s actxprxy.dll
VERBOSE: regsvr32.exe / s softpub.dll
VERBOSE: regsvr32.exe / s wintrust.dll
VERBOSE: regsvr32.exe / s dssenh.dll
VERBOSE: regsvr32.exe / s rsaenh.dll
VERBOSE: regsvr32.exe / s gpkcsp.dll
VERBOSE: regsvr32.exe / s sccbase.dll
VERBOSE: regsvr32.exe / s slbcsp.dll
VERBOSE: regsvr32.exe / s cryptdlg.dll
VERBOSE: regsvr32.exe / s oleaut32.dll
VERBOSE: regsvr32.exe / s ole32.dll
VERBOSE: regsvr32.exe / s shell32.dll
VERBOSE: regsvr32.exe / s initpki.dll
VERBOSE: regsvr32.exe / s wuapi.dll
VERBOSE: regsvr32.exe / s wuaueng.dll
VERBOSE: regsvr32.exe / s wuaueng1.dll
VERBOSE: regsvr32.exe / s wucltui.dll
VERBOSE: regsvr32.exe / s wups.dll
VERBOSE: regsvr32.exe / s wups2.dll
VERBOSE: regsvr32.exe / s wuweb.dll
VERBOSE: regsvr32.exe / s qmgr.dll
VERBOSE: regsvr32.exe / s qmgrprxy.dll
VERBOSE: regsvr32.exe / s wucltux.dll
VERBOSE: regsvr32.exe / s muweb.dll
VERBOSE: regsvr32.exe / s wuwebv.dll
Step 7: Reset WinSock
VERBOSE: netsh winsock reset
Step 8: Reset Proxy
VERBOSE: netsh winhttp reset proxy
Step 9: Start Windows Update services
VERBOSE: Cryptographic Services (cryptsvc)
VERBOSE: Application Identity (appidsvc)
VERBOSE: Windows Update (wuauserv)
VERBOSE: Background Intelligent Transfer Service (BITS)
Step 10: Start Windows Update services
VERBOSE: wuauclt /resetauthorization /detectnow
在“设置”面板中搜索更新,或使用 PowerShell 查找可用的 Windows 更新:
Get-WUList
使用重置 Windows 更新工具
重置 Windows 更新工具是另一个用于重置 Windows 更新设置的有用且简单的工具。该脚本曾在 TechNet 上提供。作者目前在 GitHub 上维护着一个存储库 (https://github.com/ManuelGil/Script-Reset-Windows-Update-Tool)。让我们考虑一下如何使用它。
已编译的 wureset.exe 文件 (C++) 或常规批处理脚本可供下载。我更喜欢使用cmd脚本。
-
下载ResetWUEng.zip并解压;
以管理员身份运行ResetWUEng.cmd;
该脚本将检测您的操作系统版本(在我的示例中为 Windows 10)并提供 18 个不同的选项。其中一些与 WU 代理设置的重置没有直接关系,但可用于修复各种 Windows 问题(使用 chkdsk 检查磁盘、使用 DISM 修复 Windows 映像、重置 Winsock、清除临时文件等);
要重置 Windows 更新,通常使用选项2 - 重置 Windows 更新组件就足够了。按2和Enter;
从命令行执行 Windows 更新代理手动重置时,该脚本将自动执行我们下面描述的所有操作;
您可以通过在任何文本编辑器中打开 ResetWUEng.cmd 文件并检查其内容来查看脚本执行的操作。例如,选项 2 会将您发送至 :components 函数。
完成重置 Windows 更新工具脚本后,重新启动计算机并检查新更新。
ResetWUEng.cmd 脚本是通用的,适用于从 Windows XP 到 Windows 11 的所有 Windows 版本。
使用命令提示符重置 Windows 更新设置
重置 Windows Update 代理和服务配置的过程包含几个步骤。所有描述的操作都在提升的命令提示符下执行。我在单个bat 文件中添加了所有命令。
使用此脚本,您可以完全重置Windows Update的配置并清除本地更新缓存。该脚本适用于 Windows 11/10/8.1/7 和 Windows Server 2022/2019/2016/2012 R2/2008 R2 的工作站。当 Windows 停止下载新更新或更新安装期间出现错误时,此脚本有助于消除最典型的 Windows 更新错误。
确保您计算机上的 Windows 更新设置未使用域或本地组策略进行配置。您可以使用
gpresult
工具或
rsop.msc
显示生成的 GPO 设置。或者您可以根据本指南重置本地 GPO 设置。
让我们逐步考虑一下这个脚本的作用:
停止 Windows 更新、BITS 和加密服务:
net stop bits net stop wuauserv net stop appidsvc net stop cryptsvc taskkill /im wuauclt.exe /f
从文件夹 %ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\ 中删除服务文件 qmgr*.dat:
Del "%ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\qmgr*.dat"
重命名系统文件夹,其中存储配置文件和更新缓存(如有必要,它们可以用作备份)。重新启动更新服务后(
wuauserv
),这些目录将自动重新创建:
Ren %systemroot%\SoftwareDistribution SoftwareDistribution.bak Ren %systemroot%\system32\catroot2 catroot2.bak
删除旧的 windowsupdate.log 文件:
del /f /s /q %windir%\windowsupdate.log
重置 BITS 和 Windows Update 服务的权限(如果服务权限已更改):
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) sc.exe sdset cryptsvc D:(A;;CCLCSWLOCRRC;;;AU)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCDCLCSWRPWPDTLCRSDRCWDWO;;;SO)(A;;CCLCSWRPWPDTLOCRRC;;;SY)S:(AU;FA;CCDCLCSWRPWPDTLOCRSDRCWDWO;;WD) sc.exe sdset trustedinstaller D:(A;;CCLCSWLOCRRC;;;AU)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCDCLCSWRPWPDTLCRSDRCWDWO;;;SO)(A;;CCLCSWRPWPDTLOCRRC;;;SY)S:(AU;FA;CCDCLCSWRPWPDTLOCRSDRCWDWO;;WD)
重新注册与BITS和Windows Update相关的系统动态库(DLL)文件:
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
重置 Winsock 设置:
netsh winsock reset
重置系统代理设置:
netsh winhttp reset proxy
可选。使用本地 WSUS 服务器时,还可以通过删除注册表项 HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate 中的以下参数来重置客户端与 WSUS 服务器的当前绑定:
REG DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v AccountDomainSid /f REG DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v PingID /f REG DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v SusClientId /f REG DELETE "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v TargetGroup /f REG DELETE "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v WUServer /f REG DELETE "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v WUStatusServer /f
启动之前停止的服务:
sc.exe config wuauserv start= auto sc.exe config bits start= delayed-auto sc.exe config cryptsvc start= auto sc.exe config TrustedInstaller start= demand sc.exe config DcomLaunch start= auto net start bits net start wuauserv net start appidsvc net start cryptsvc
可选。在某些情况下,您需要安装/重新安装 Windows Update Agent (WUA) 版本。您可以使用 PowerShell 检查计算机上当前的 Windows Update Agent Wuaueng.dll 文件版本:
((Get-Item $Env:windir\system32\Wuaueng.dll).VersionInfo).ProductVersion
您可以在此处下载最新版本的 Windows Update 代理:https://support.microsoft.com/en-us/kb/949104。
Windows 8.1 -7.9.9600
Windows 8 -
7.8.9200.16693
Windows 7的 -
7.6.7600.256
使用以下命令强制重新安装 Windows Update Agent:Windows7x86:
WindowsUpdateAgent-7.6-x86.exe /quiet /norestart /wuforce
Windows 7 x64:
WindowsUpdateAgent-7.6-x64.exe /quiet /norestart /wuforce
现在您只需重新启动计算机并与 Windows Update 或 WSUS 运行同步即可。
wuauclt /resetauthorization /detectnow
然后转到 Windows 更新并确保检查、下载和安装更新时没有错误。
可以通过此链接 reset_windows_update_agent.zip 下载 reset_windows_update_agent.bat 脚本(选项 9 和 11 不包含在脚本中,因为它们是可选的)。下载脚本,解压并以管理员身份运行。
如果正确下载并安装了 Windows 更新,您可以删除备份文件夹:
Ren %systemroot%\SoftwareDistribution SoftwareDistribution.bak
Ren %systemroot%\system32\catroot2 catroot2.bak
如果所有其他方法均失败,请尝试从 Microsoft 更新目录手动下载并安装适用于您的 Windows 版本的最新累积更新。
猜你还喜欢
- 03-30 [玩转系统] 如何用批处理实现关机,注销,重启和锁定计算机
- 02-14 [系统故障] Win10下报错:该文件没有与之关联的应用来执行该操作
- 01-07 [系统问题] Win10--解决锁屏后会断网的问题
- 01-02 [系统技巧] Windows系统如何关闭防火墙保姆式教程,超详细
- 12-15 [玩转系统] 如何在 Windows 10 和 11 上允许多个 RDP 会话
- 12-15 [玩转系统] 查找 Exchange/Microsoft 365 中不活动(未使用)的通讯组列表
- 12-15 [玩转系统] 如何在 Windows 上安装远程服务器管理工具 (RSAT)
- 12-15 [玩转系统] 如何在 Windows 上重置组策略设置
- 12-15 [玩转系统] 如何获取计算机上的本地管理员列表?
- 12-15 [玩转系统] 在 Visual Studio Code 中连接到 MS SQL Server 数据库
- 12-15 [玩转系统] 如何降级 Windows Server 版本或许可证
- 12-15 [玩转系统] 如何允许非管理员用户在 Windows 中启动/停止服务
取消回复欢迎 你 发表评论:
- 精品推荐!
-
- 最新文章
- 热门文章
- 热评文章
[电视剧] 棋士(2025) 4K 1080P【全22集】悬疑 犯罪 王宝强 陈明昊
[软件合集] 25年6月5日 精选软件22个
[软件合集] 25年6月4日 精选软件36个
[短剧] 2025年06月04日 精选+付费短剧推荐33部
[短剧] 2025年06月03日 精选+付费短剧推荐25部
[软件合集] 25年6月3日 精选软件44个
[短剧合集] 2025年06月2日 精选+付费短剧推荐39部
[软件合集] 25年6月2日 精选软件18个
[软件合集] 25年6月1日 精选软件15个
[短剧合集] 2025年06月1日 精选+付费短剧推荐59部
[剧集] [央视][笑傲江湖][2001][DVD-RMVB][高清][40集全]李亚鹏、许晴、苗乙乙
[电视剧] 欢乐颂.5部全 (2016-2024)
[电视剧] [突围] [45集全] [WEB-MP4/每集1.5GB] [国语/内嵌中文字幕] [4K-2160P] [无水印]
[影视] 【稀有资源】香港老片 艺坛照妖镜之96应召名册 (1996)
[剧集] 神经风云(2023)(完结).4K
[剧集] [BT] [TVB] [黑夜彩虹(2003)] [全21集] [粤语中字] [TV-RMVB]
[资源] B站充电视频合集,包含多位重量级up主,全是大佬真金白银买来的~【99GB】
[影视] 内地绝版高清录像带 [mpg]
[书籍] 古今奇书禁书三教九流资料大合集 猎奇必备珍藏资源PDF版 1.14G
[美图] 2W美女个美女小姐姐,饱眼福
[电视剧] [突围] [45集全] [WEB-MP4/每集1.5GB] [国语/内嵌中文字幕] [4K-2160P] [无水印]
[剧集] [央视][笑傲江湖][2001][DVD-RMVB][高清][40集全]李亚鹏、许晴、苗乙乙
[电影] 美国队长4 4K原盘REMUX 杜比视界 内封简繁英双语字幕 49G
[电影] 死神来了(1-6)大合集!
[软件合集] 25年05月13日 精选软件16个
[精品软件] 25年05月15日 精选软件18个
[绝版资源] 南与北 第1-2季 合集 North and South (1985) /美国/豆瓣: 8.8[1080P][中文字幕]
[软件] 25年05月14日 精选软件57个
[短剧] 2025年05月14日 精选+付费短剧推荐39部
[短剧] 2025年05月15日 精选+付费短剧推荐36部
- 最新评论
-
- 热门tag