更新失敗的問題我已經參考這篇文章解決了: 【親測管用】Windows10無法完成更新,正在撤銷更改怎麼辦?
精簡腳本,在不删除服務的情況下阻止自動更新:
【已解決】【V2版本】如何使用腳本關閉Win10自動更新服務并阻止其自動啟動?
【已解決】【V3版本】如何使用腳本關閉Win10自動更新服務并阻止其自動啟動?
更新說明:
V1.1和V1.0版本不一樣的地方是,V1.1版本是删除"usosvc"服務,而V1.0版本是删除"wuauserv"服務,由于"wuauserv"同時也提供了應用商店等其他程式的更新服務,是以删除後會導緻應用商店等其他程式無法更新,使用V1.1版本則無此問題,因為V1.1版本删除的服務"usosvc"不影響其它程式,僅對Windows更新程式起作用;
前言:
如何關閉Windows10的自動更新真的是個大難題.
當你遇到Windows更新包安裝失敗,卻又被強制每天重新安裝并且失敗(安裝失敗有的時候得重新開機好幾次),望着一遍又一遍重新開機的計算機,你是不是有些抓狂?
這裡給了你一個解決辦法,那就是徹底删除Windows自動更新服務(usosvc)來阻止自動更新.
首先我們講如何備份相關系統資料庫,手動删除這個服務,并且在必要的時候如何手動恢複這個服務.
然後我會給出一個激動人心的腳本,自動完成"備份/删除/恢複usosvc服務"的操作.
第一部分 手動備份,删除及恢複usosvc服務.
1.備份系統資料庫;
usosvc服務的大部分資訊都存在"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\usosvc"路徑中,是以要備份這個子鍵,然後在需要的時候會用到.
方法是按Win+R打開運作視窗,或者按Win+Q打開搜尋視窗,輸入regedit并點選回車(Enter);
找到路徑"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\usosvc",在"usosvc"上點選滑鼠右鍵,選擇"導出":

選擇路徑并儲存檔案(記住檔案完整路徑,一會兒恢複的時候要用到):
2.删除usosvc服務;
此操作很簡單,在螢幕左下角的"開始"按鈕
上點選右鍵,選擇"Windows PowerShell (管理者)(A)";
輸入以下内容禁用Windows Update:
sc.exe stop usosvc
sc.exe delete usosvc
此時windows 10 已經不會再執行自動更新了......
如果想恢複使用自動更新,那就繼續看......
3.恢複usosvc服務;
恢複服務是相對難度比較高的操作,
在"開始"按鈕上點選右鍵,選擇"Windows PowerShell (管理者)(A)";
輸入以下内容恢複usosvc(Windows Update)服務:
sc.exe create usosvc binpath="c:\windows\system32\svchost.exe -k netsvcs -p -s UsoSvc" type=share start=auto error=normal tag=no depend=rpcss displayname="更新 Orchestrator 服務"
這還不夠,還需要找到第1步儲存的系統資料庫檔案,輕按兩下導入reg檔案.
完了以後回到PowerShell視窗.
輸入:
sc.exe start usosvc
等會兒再輸入:
sc.exe query usosvc
此時服務已經恢複成功,并且成功啟動了.
第二部分 使用腳本自動備份删除及恢複usosvc服務.
1.儲存檔案;
先上腳本(檔案名"管理Win10自動更新v1.1.vbs",儲存編碼"ANSI"):
' 管理Win10自動更新.vbs.
' 20210613 v1.1 補充了-s參數(無實際作用,僅保證完整性);
' 20210322 v1.1 為消除副作用,不再禁用wuauserv,改為禁用usosvc;
' 20190410 v1.0 增加了自動提權代碼;
' 20190405 v1.0 初始版本,實作了基本功能;
' 使用說明 https://blog.csdn.net/milaoshu1020/article/details/89045265
Const usosvc_reg = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\usosvc"
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. 備份usosvc服務的系統資料庫資訊;" & vbcrlf & _
"2. 删除usosvc服務(将禁止Win10自動更新);" & vbcrlf & _
"3. 恢複usosvc服務(将恢複Win10自動更新);" & vbcrlf & _
vbcrlf & _
"請輸入序号:",,"1")
Select Case ret
Case "1"
retnum = shell.run("regedit.exe /s /e """ & userregpath & """ """ & usosvc_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 usosvc",0,True)
retnum = shell.run("sc.exe delete usosvc",0,True)
If retnum = 0 Then
msgbox "已删除usosvc服務!已禁止Win10自動更新!",vbexclamation
Else
msgbox "删除usosvc服務失敗!'sc.exe'傳回代碼:" & retnum,vbcritical
End If
Exit Do
Case "3"
If fso.fileexists(userregpath) Then
retnum = shell.run("sc.exe create usosvc binpath= ""c:\windows\system32\svchost.exe -k netsvcs -p -s UsoSvc"" type= share " & _
"start= auto error= normal tag= no depend= rpcss displayname= ""更新 Orchestrator 服務""",0,True)
If retnum <> 0 Then
msgbox "恢複usosvc服務失敗!'sc.exe'傳回代碼:" & retnum,vbcritical
Exit Do
End If
retnum = shell.run("regedit.exe /s """ & userregpath & """",0,True)
If retnum <> 0 Then
msgbox "恢複usosvc服務失敗!'regedit.exe'傳回代碼:" & retnum,vbcritical
Exit Do
End If
ElseIf fso.fileexists(defaultregpath) Then
retnum = shell.run("sc.exe create usosvc binpath= ""c:\windows\system32\svchost.exe -k netsvcs -p -s UsoSvc"" type= share " & _
"start= auto error= normal tag= no depend= rpcss displayname= ""更新 Orchestrator 服務""",0,True)
If retnum <> 0 Then
msgbox "恢複usosvc服務失敗!'sc.exe'傳回代碼:" & retnum,vbcritical
Exit Do
End If
retnum = shell.run("regedit.exe /s """ & defaultregpath & """",0,True)
If retnum <> 0 Then
msgbox "恢複usosvc服務失敗!'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 usosvc",0,True)
If retnum <> 0 Then
msgbox "啟動usosvc服務失敗!'sc.exe'傳回代碼:" & retnum,vbcritical
Exit Do
End If
msgbox "成功恢複usosvc服務!成功恢複Win10自動更新!",vbexclamation
Exit Do
Case ""
Exit Do
Case Else
msgbox "輸入錯誤!請重新輸入!",vbcritical
End Select
Loop
End Sub
再上系統資料庫檔案(檔案名"default.reg"):
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\UsoSvc]
"DelayedAutoStart"=dword:00000001
"DependOnService"=hex(7):72,00,70,00,63,00,73,00,73,00,00,00,00,00
"Description"="@%systemroot%\\system32\\usosvc.dll,-102"
"DisplayName"="@%systemroot%\\system32\\usosvc.dll,-101"
"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,c0,d4,01,00,01,00,00,00,e0,93,04,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"
"PreshutdownTimeout"=dword:0036ee80
"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
"Type"=dword:00000020
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\UsoSvc\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,\
75,00,73,00,6f,00,73,00,76,00,63,00,2e,00,64,00,6c,00,6c,00,00,00
"ServiceDllUnloadOnStop"=dword:00000001
"ServiceMain"="ServiceMain"
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\UsoSvc\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
将這兩個檔案放到同一個目錄下.
為了友善菜鳥,在此提供腳本檔案和預設系統資料庫檔案的下載下傳位址:
百度網盤:
連結:https://pan.baidu.com/s/1MLPzqQZsaehfhzw5OC07xQ
提取碼:8488
其中"管理Win10自動更新v1.1.vbs"檔案是開源的腳本檔案,功能是備份/删除/恢複usosvc服務,以禁用/恢複Windows自動更新的功能;
"default.reg"檔案是标準的系統資料庫檔案,用于在沒有備份的情況下恢複usosvc服務的系統資料庫結構.
2.啟動腳本;
輕按兩下運作腳本,顯示對話框:
按照提示操作即可.
更新失敗的問題我已經參考這篇文章解決了: 【親測管用】Windows10無法完成更新,正在撤銷更改怎麼辦?
精簡腳本,在不删除服務的情況下阻止自動更新:
【已解決】【V2版本】如何使用腳本關閉Win10自動更新服務并阻止其自動啟動?
【已解決】【V3版本】如何使用腳本關閉Win10自動更新服務并阻止其自動啟動?
FAQ:
Q:恢複成功,但是"usosvc"服務無法啟動,怎麼辦?
A:可以打開系統資料庫"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\usosvc"找到"WOW64"資料項,删除即可;