【親測管用】如何使用腳本關閉Win10自動更新服務並阻止其自動啓動?

介紹:

該腳本可以關閉"wuauserv"(Win10自動更新服務),並阻止其自動啓動;

需要再次運行腳本,並選擇恢復,才能啓動"wuauserv"(Win10自動更新服務);

該腳本的原理是,在註冊表的"wuauserv"目錄項下,增加一個"WOW64"值,數據爲"dword:0000014c";

該值會阻止wuauserv服務的啓動;需要恢復的時候刪除此值即可;

相對於以前的方法,此方法改動小,風險小,但可能只支持64位Win10(32位的沒試過);

腳本運行界面如下:

按提示操作即可;

腳本代碼如下(文件名"管理Win10自動更新v2.vbs",保存編碼"ANSI"):

' 管理Win10自動更新v2.vbs.
' 20190607 初始版本,實現了基本功能;
' 使用說明 https://blog.csdn.net/milaoshu1020/article/details/91126200
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)

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. 禁止Win10自動更新;" & vbcrlf & _
						"2. 恢復Win10自動更新;" & vbcrlf & _
						vbcrlf & _
						"請輸入序號:",,"1")
		Select Case ret
		Case "1"
			retnum = shell.run("sc.exe stop wuauserv",0,True)
			shell.regwrite wuauserv_reg & "\WOW64",&H14c,"REG_DWORD"
			msgbox "已禁止Win10自動更新!",vbexclamation
			Exit Do
		Case "2"
			shell.regdelete wuauserv_reg & "\WOW64"
			retnum = shell.run("sc.exe start wuauserv",0,True)
			msgbox "已恢復Win10自動更新!",vbexclamation
			Exit Do
		Case ""
			Exit Do
		Case Else
			msgbox "輸入錯誤!請重新輸入!",vbcritical
		End Select
	Loop
End Sub

爲了方便小白,這裏提供腳本的下載地址.

下載地址:

鏈接:https://pan.baidu.com/s/17I_qvtCyVGOFOcrkyOG_bA 
提取碼:01hu

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章