彻底关闭win10系统更新

admin 2022年1月6日01:53:31安全博客评论16 views9356字阅读31分11秒阅读模式

如何关闭Windows10的自动更新真的是个大难题.

当你遇到Windows更新包安装失败,却又被强制每天重新安装并且失败(安装失败有的时候得重启好几次),望着一遍又一遍重启的计算机,你是不是有些抓狂?

这里给了你一个解决办法,那就是彻底删除自动更新服务(wuauserv)来阻止自动更新.

首先我们讲如何备份相关注册表,手动删除这个服务,并且在必要的时候如何手动恢复这个服务.

然后我会给出一个激动人心的脚本,自动完成”备份/删除/恢复wuauserv服务”的操作.

第一部分 手动备份,删除及恢复wuauserv服务.

1.备份注册表;

wuauserv服务的大部分信息都存在”HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\wuauserv”路径中,所以要备份这个子键,然后在需要的时候会用到.

方法是按Win+R打开运行窗口,或者按Win+Q打开搜索窗口,输入regedit并点击回车(Enter);

找到路径”HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\wuauserv”,在”wuauserv”上点击鼠标右键,选择”导出”:

img

选择路径并保存文件(记住文件完整路径,一会儿恢复的时候要用到):

2.删除wuauserv服务;

此操作很简单,在”开始”按钮上点击右键,选择”Windows PowerShell (管理员)(A)”;

输入以下内容禁用Windows Update:

sc.exe stop wuauserv

sc.exe delete wuauserv

img

此时windows 10 已经不会再执行自动更新了……

如果想恢复使用自动更新,那就继续看……

3.恢复wuauserv服务;

恢复服务是相对难度比较高的操作,

在”开始”按钮上点击右键,选择”Windows PowerShell (管理员)(A)”;

输入以下内容恢复wuauserv(Windows Update)服务:

1
sc.exe create wuauserv binpath="c:\windows\system32\svchost.exe -k netsvcs -p" type=share start=auto error=normal tag=no depend=rpcss displayname="Windows Update"

img

这还不够,还需要找到第1步保存的注册表文件,双击导入reg文件.

img

完了以后回到PowerShell窗口.

输入:

sc.exe start wuauserv

img

等会儿再输入:

sc.exe query wuauserv

img

此时服务已经恢复成功,并且成功启动了.

第二部分 使用脚本自动备份删除及恢复wuauserv服务.

1.保存文件;

先上脚本(文件名”管理Win10自动更新.vbs”,保存编码”ANSI”):

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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
' 管理Win10自动更新.vbs.
' 20190410 增加了自动提权代码;
' 20190405 初始版本,实现了基本功能;
' 使用说明 https://blog.csdn.net/milaoshu1020/article/details/89045265
Const wuauserv_reg = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\wuauserv"
Set fso = createobject("scripting.filesystemobject")
Set shell = createobject("wscript.shell")
curdir = fso.getparentfoldername(wscript.scriptfullname)
userregpath = fso.buildpath(curdir,"user.reg")
defaultregpath = fso.buildpath(curdir,"default.reg")

If wscript.arguments.count = 0 Then
Set sh = createobject("shell.application")
sh.shellexecute wscript.fullname,"""" & wscript.scriptfullname & """ -admin",,"runas"
ElseIf wscript.arguments.count = 1 And wscript.arguments(0) = "-admin" Then
run
Else
msgbox "脚本启动参数错误!"
End If

Sub Run()
Do
ret = inputbox("1. 备份wuauserv服务的注册表信息;" & vbcrlf & _
"2. 删除wuauserv服务(将禁止Win10自动更新);" & vbcrlf & _
"3. 恢复wuauserv服务(将恢复Win10自动更新);" & vbcrlf & _
vbcrlf & _
"请输入序号:",,"1")
Select Case ret
Case "1"
retnum = shell.run("regedit.exe /s /e """ & userregpath & """ """ & wuauserv_reg & """",0,True)
If retnum = 0 Then
msgbox "注册表备份完成!",vbinformation
Else
msgbox "注册表备份失败!'regedit.exe'返回代码:" & retnum,vbcritical
End If
Exit Do
Case "2"
retnum = shell.run("sc.exe stop wuauserv",0,True)
retnum = shell.run("sc.exe delete wuauserv",0,True)
If retnum = 0 Then
msgbox "已删除wuauserv服务!已禁止Win10自动更新!",vbexclamation
Else
msgbox "删除wuauserv服务失败!'sc.exe'返回代码:" & retnum,vbcritical
End If
Exit Do
Case "3"
If fso.fileexists(userregpath) Then
retnum = shell.run("sc.exe create wuauserv binpath= ""c:\windows\system32\svchost.exe -k netsvcs -p"" type= share " & _
"start= auto error= normal tag= no depend= rpcss displayname= ""Windows Update""",0,True)
If retnum <> 0 Then
msgbox "恢复wuauserv服务失败!'sc.exe'返回代码:" & retnum,vbcritical
Exit Do
End If
retnum = shell.run("regedit.exe /s """ & userregpath & """",0,True)
If retnum <> 0 Then
msgbox "恢复wuauserv服务失败!'regedit.exe'返回代码:" & retnum,vbcritical
Exit Do
End If
ElseIf fso.fileexists(defaultregpath) Then
retnum = shell.run("sc.exe create wuauserv binpath= ""c:\windows\system32\svchost.exe -k netsvcs -p"" type= share " & _
"start= auto error= normal tag= no depend= rpcss displayname= ""Windows Update""",0,True)
If retnum <> 0 Then
msgbox "恢复wuauserv服务失败!'sc.exe'返回代码:" & retnum,vbcritical
Exit Do
End If
retnum = shell.run("regedit.exe /s """ & defaultregpath & """",0,True)
If retnum <> 0 Then
msgbox "恢复wuauserv服务失败!'regedit.exe'返回代码:" & retnum,vbcritical
Exit Do
End If
Else
msgbox "未找到注册表文件(user.reg|default.reg)!恢复失败!",vbcritical
Exit Do
End If

retnum = shell.run("sc.exe start wuauserv",0,True)
If retnum <> 0 Then
msgbox "启动wuauserv服务失败!'sc.exe'返回代码:" & retnum,vbcritical
Exit Do
End If

msgbox "成功恢复wuauserv服务!成功恢复Win10自动更新!",vbexclamation
Exit Do
Case ""
Exit Do
Case Else
msgbox "输入错误!请重新输入!",vbcritical
End Select
Loop

End Sub

再上注册表文件(文件名”default.reg”):

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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\wuauserv]
"DependOnService"=hex(7):72,00,70,00,63,00,73,00,73,00,00,00,00,00
"Description"="@%systemroot%\\system32\\wuaueng.dll,-106"
"DisplayName"="@%systemroot%\\system32\\wuaueng.dll,-105"
"ErrorControl"=dword:00000001
"FailureActions"=hex:80,51,01,00,00,00,00,00,00,00,00,00,03,00,00,00,14,00,00,\
00,01,00,00,00,60,ea,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
"ImagePath"=hex(2):25,00,73,00,79,00,73,00,74,00,65,00,6d,00,72,00,6f,00,6f,00,\
74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,73,\
00,76,00,63,00,68,00,6f,00,73,00,74,00,2e,00,65,00,78,00,65,00,20,00,2d,00,\
6b,00,20,00,6e,00,65,00,74,00,73,00,76,00,63,00,73,00,20,00,2d,00,70,00,00,\
00
"ObjectName"="LocalSystem"
"RequiredPrivileges"=hex(7):53,00,65,00,41,00,75,00,64,00,69,00,74,00,50,00,72,\
00,69,00,76,00,69,00,6c,00,65,00,67,00,65,00,00,00,53,00,65,00,43,00,72,00,\
65,00,61,00,74,00,65,00,47,00,6c,00,6f,00,62,00,61,00,6c,00,50,00,72,00,69,\
00,76,00,69,00,6c,00,65,00,67,00,65,00,00,00,53,00,65,00,43,00,72,00,65,00,\
61,00,74,00,65,00,50,00,61,00,67,00,65,00,46,00,69,00,6c,00,65,00,50,00,72,\
00,69,00,76,00,69,00,6c,00,65,00,67,00,65,00,00,00,53,00,65,00,54,00,63,00,\
62,00,50,00,72,00,69,00,76,00,69,00,6c,00,65,00,67,00,65,00,00,00,53,00,65,\
00,41,00,73,00,73,00,69,00,67,00,6e,00,50,00,72,00,69,00,6d,00,61,00,72,00,\
79,00,54,00,6f,00,6b,00,65,00,6e,00,50,00,72,00,69,00,76,00,69,00,6c,00,65,\
00,67,00,65,00,00,00,53,00,65,00,49,00,6d,00,70,00,65,00,72,00,73,00,6f,00,\
6e,00,61,00,74,00,65,00,50,00,72,00,69,00,76,00,69,00,6c,00,65,00,67,00,65,\
00,00,00,53,00,65,00,49,00,6e,00,63,00,72,00,65,00,61,00,73,00,65,00,51,00,\
75,00,6f,00,74,00,61,00,50,00,72,00,69,00,76,00,69,00,6c,00,65,00,67,00,65,\
00,00,00,53,00,65,00,53,00,68,00,75,00,74,00,64,00,6f,00,77,00,6e,00,50,00,\
72,00,69,00,76,00,69,00,6c,00,65,00,67,00,65,00,00,00,53,00,65,00,44,00,65,\
00,62,00,75,00,67,00,50,00,72,00,69,00,76,00,69,00,6c,00,65,00,67,00,65,00,\
00,00,53,00,65,00,42,00,61,00,63,00,6b,00,75,00,70,00,50,00,72,00,69,00,76,\
00,69,00,6c,00,65,00,67,00,65,00,00,00,53,00,65,00,52,00,65,00,73,00,74,00,\
6f,00,72,00,65,00,50,00,72,00,69,00,76,00,69,00,6c,00,65,00,67,00,65,00,00,\
00,53,00,65,00,53,00,65,00,63,00,75,00,72,00,69,00,74,00,79,00,50,00,72,00,\
69,00,76,00,69,00,6c,00,65,00,67,00,65,00,00,00,53,00,65,00,54,00,61,00,6b,\
00,65,00,4f,00,77,00,6e,00,65,00,72,00,73,00,68,00,69,00,70,00,50,00,72,00,\
69,00,76,00,69,00,6c,00,65,00,67,00,65,00,00,00,53,00,65,00,4c,00,6f,00,61,\
00,64,00,44,00,72,00,69,00,76,00,65,00,72,00,50,00,72,00,69,00,76,00,69,00,\
6c,00,65,00,67,00,65,00,00,00,53,00,65,00,4d,00,61,00,6e,00,61,00,67,00,65,\
00,56,00,6f,00,6c,00,75,00,6d,00,65,00,50,00,72,00,69,00,76,00,69,00,6c,00,\
65,00,67,00,65,00,00,00,53,00,65,00,53,00,79,00,73,00,74,00,65,00,6d,00,45,\
00,6e,00,76,00,69,00,72,00,6f,00,6e,00,6d,00,65,00,6e,00,74,00,50,00,72,00,\
69,00,76,00,69,00,6c,00,65,00,67,00,65,00,00,00,53,00,65,00,43,00,72,00,65,\
00,61,00,74,00,65,00,53,00,79,00,6d,00,62,00,6f,00,6c,00,69,00,63,00,4c,00,\
69,00,6e,00,6b,00,50,00,72,00,69,00,76,00,69,00,6c,00,65,00,67,00,65,00,00,\
00,53,00,65,00,49,00,6e,00,63,00,72,00,65,00,61,00,73,00,65,00,42,00,61,00,\
73,00,65,00,50,00,72,00,69,00,6f,00,72,00,69,00,74,00,79,00,50,00,72,00,69,\
00,76,00,69,00,6c,00,65,00,67,00,65,00,00,00,00,00
"ServiceSidType"=dword:00000001
"Start"=dword:00000002
"SvcMemHardLimitInMB"=dword:000000f6
"SvcMemMidLimitInMB"=dword:000000a7
"SvcMemSoftLimitInMB"=dword:00000058
"Type"=dword:00000020

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\wuauserv\Parameters]
"ServiceDll"=hex(2):25,00,73,00,79,00,73,00,74,00,65,00,6d,00,72,00,6f,00,6f,\
00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,\
77,00,75,00,61,00,75,00,65,00,6e,00,67,00,2e,00,64,00,6c,00,6c,00,00,00
"ServiceDllUnloadOnStop"=dword:00000001
"ServiceMain"="WUServiceMain"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\wuauserv\Security]
"Security"=hex:01,00,14,80,78,00,00,00,84,00,00,00,14,00,00,00,30,00,00,00,02,\
00,1c,00,01,00,00,00,02,80,14,00,ff,00,0f,00,01,01,00,00,00,00,00,01,00,00,\
00,00,02,00,48,00,03,00,00,00,00,00,14,00,9d,00,02,00,01,01,00,00,00,00,00,\
05,0b,00,00,00,00,00,18,00,ff,01,0f,00,01,02,00,00,00,00,00,05,20,00,00,00,\
20,02,00,00,00,00,14,00,ff,01,0f,00,01,01,00,00,00,00,00,05,12,00,00,00,01,\
01,00,00,00,00,00,05,12,00,00,00,01,01,00,00,00,00,00,05,12,00,00,00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\wuauserv\TriggerInfo]

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\wuauserv\TriggerInfo\0]
"Type"=dword:00000005
"Action"=dword:00000001
"Guid"=hex:e6,ca,9f,65,db,5b,a9,4d,b1,ff,ca,2a,17,8d,46,e0

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\wuauserv\TriggerInfo\1]
"Type"=dword:00000005
"Action"=dword:00000001
"Guid"=hex:c8,46,fb,54,89,f0,4c,46,b1,fd,59,d1,b6,2c,3b,50

将这两个文件放到同一个目录下.

其中vbs文件是开源的脚本文件,功能是备份/删除/恢复wuauserv服务,以禁用/恢复Windows自动升级的功能;

reg文件是标准的注册表文件,用于在没有备份的情况下恢复wuauserv服务的注册表结构.

2.启动脚本;

双击运行脚本,显示对话框:

img

按照提示操作即可.

FAQ:
Q:恢复成功,但是”wuauserv”服务无法启动,怎么办?

A:可以打开注册表”HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\wuauserv”找到”WOW64”数据项,删除即可。
————————————————
原文链接:https://blog.csdn.net/milaoshu1020/article/details/89045265

FROM :b0urne.top | Author:b0urne

特别标注: 本站(CN-SEC.COM)所有文章仅供技术研究,若将其信息做其他用途,由用户承担全部法律及连带责任,本站不承担任何法律及连带责任,请遵守中华人民共和国安全法.
  • 我的微信
  • 微信扫一扫
  • weinxin
  • 我的微信公众号
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2022年1月6日01:53:31
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                  彻底关闭win10系统更新 http://cn-sec.com/archives/722911.html

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: