停止自动更新 Windows 10

分享于 

36分钟阅读

电脑

  繁體
问题:

我已经将一些计算机升级到Windows 10,我知道微软会根据需要进行更新。

我的问题是,有人知道停止自动更新的方法吗?停止服务是唯一的解决方案?


答案1:

如果你是专业版,打开组策略编辑器(gpedit.msc )搜索配置自动更新条目,位于:


computer configuration → administrative templates → windows components → windows update



然后选择Notify for download and notify for install

当Windows检测到新更新时显示通知

你还可以使用更新KB3073930中的疑难解答来禁用一些有问题的更新,以便它们不会再次安装。

这是微软阻止安装不需要的更新和驱动程序的正式方法。

但是,有一个Windows Update MiniTool的第三方工具允许选择哪些更新可以安装,并允许阻止在以前的Windows版本中的更新。


答案2:

关于Windows 10最具争议的方面之一是Microsoft决定强制进行更新。如果你具有Windows 10 Pro,Enterprise或Education版本,则可以推迟更新,但是,不能完全拒绝更新。

W10Privacy 2,你可以将程序设置为禁用Windows 10自己的更新机制,并用它自己的更新机制替换它,用户可以选择要安装的更新和忽略的更新,

使用此功能之前,你需要下载一些其他组件。执行以下步骤:

下载W10Privacy 2解压到硬盘上的文件夹, 下载PsExec (部分PsTools软件包并将它复制到W10Privacy文件夹中, 从Windows文件夹下载PowerShell Update模块,并将它解压缩, PSWindows更新模块存在(必须由用户以前提供给W10Privacy文件夹), PsExec.exe在W10Privacy文件夹中(必须由用户提供),W10Privacy PSWindows-Update模块的自适应,

配置伪WSUS服务器。

W10Privacy位于没有空格的路径或文件夹中,在更新搜索中不考虑驱动程序。

单击Set changed settings设置更改设置,然后单击Start checking for updates按钮,将显示尚未安装的新更新,然后选择要执行的操作,

一旦负责更新,定期运行软件并检查以确保你没有错过重要的更新;

如何获得对Windows 10 s自动更新的完全控制
答案3:

我成功地解决了如何停止Windows 10上的自动更新。

请注意,这适用于Windows 10 专业版,因为它是我运行的版本。

打开设置 单击更新&安全性 点击高级选项 确保已选中"延迟升级"选项 关闭设置窗口,就这样结束了!
答案4:

对于Windows 10家庭用户

你要禁用重新启动服务,而不是更新服务,

在Windows Explorer窗口中,重命名文件:C:WindowsSystem32TasksMicrosoftWindowsUpdateOrchestratorReboot 假设你的%windir%C: )到Reboot.old,注意,这里将询问管理员访问权限, 在中创建名为Reboot的目录C:WindowsSystem32TasksMicrosoftWindowsUpdateOrchestrator 此操作将阻止Windows重新创建同名的文件,注意,这里将询问管理员访问权限, 重新启动计算机,这将重置所有服务,并阻止重新启动服务启动,
答案5:

阻止升级,自动安装,下载,服务,IFEO安全阻止,不改变所有权,删除文件或删除任务。

windows_update_toggle.bat


@set @version=10.0 /* &title Windows Update Toggle


@echo off &set"verbose="


echo.


echo ---------------------------------------------------------------------


echo : Windows Update Toggle v10.0 final :


echo :---------------------------------------------------------------------:


echo : Block/Enable Upgrades, Installs, Downloads(!), Service(!) :


echo : Disable/Enable Reporting, Speech, SearchUI, Defender :


echo : Hide/Unhide/Apply update lists with count and max size :


echo : Preset for Defender updates and Store downloads working :


echo : :


echo : Toggle from the comfort of Desktop right-click context menu :


echo ---------------------------------------------------------------------


echo.


:: AveYo, 2018-05-13



if %1.==. timeout /t 10 &call wscript /e:JScript"%~f0" runas setup &exit/b &rem : no arguments, run setup elevated


if %1.==shift. shift &shift &rem : if loaded by WScript, shift args to prevent loop and restore %0


if %1.==. echo ERROR! &timeout /t 5 &exit/b : must have at least one arg



:: Setup executable blocking via ifeo


set notifier=EOSNotify MusNotification


set upgrader=Windows10UpgraderApp Windows10Upgrade WindowsUpdateBox SetupHost setupprep


set installer=wuauclt


set reporter=wermgr wsqmcons DiagTrackRunner DiagnosticsHub.StandardCollector.Service CompatTelRunner


set speecher=SpeechRuntime SpeechModelDownload


set searcher=SearchUI



set"exe=%notifier% %upgrader% %installer% %reporter%"


set"noop=%SystemRoot%system32systray.exe"


set"ifeo=HKLMSOFTWAREMicrosoftWindows NTCurrentVersionImage File Execution Options"


set"menu=HKCRDesktopBackgroundshellWUT"


set"f0=%SystemRoot%windows_update_toggle.bat"


set"task=wscript.exe /e:JScript"%f0%" schtasks WUT"


set"DefMUS={MicrosoftUpdateServer|MMPC|InternalDefinitionUpdateServer}"


set"DefMMPC={MMPC|MicrosoftUpdateServer|InternalDefinitionUpdateServer}"


set".=>nul 2>nul"


for /f"tokens=2 delims=1234567890" %%# in ('shutdown /?^|findstr /bc:"E"') do set"[T]=%%#" &rem : cosmetic usage in menus


if defined verbose (echo on &set".=" &set"window=") else set"window=hide"


call :%~1 %2 %3 %4 %5 %6 %7 %8 %9 &rem : launch secondary functions below dinamically, passing next args


echo.


echo Done! Use the Desktop right-click context menu to toggle, renew or uninstall


if"%~1"=="setup" (pause) else if defined verbose timeout /t 5


exit/b : End of main script, functions below



:refresh context menu


echo %0 %*


call :reg_query"HKLMSOFTWAREWUT.bat" NoBlock noblock


if"%noblock%"=="Enable" exit/b


call :reg_query"%menu%0pending" MUIVerb pending


if defined pending exit/b


for %%# in ("1hide""2unhide""3apply") do reg delete"%menu%%%~#" /f %.%


reg add"%menu%0pending" /v MUIVerb /d"Pending.." /f %.%


reg add"%menu%0pending" /v SubCommands /d"" /f %.%


call :reg_query"HKLMSOFTWAREWUT.bat" NoRefresh norefresh


if"%norefresh%"=="Disable" start"WUT" wscript /e:JScript"%f0%" WUTRefresh


call :status SetupHost


reg add"%menu%shell3Upgrades" /v MUIVerb /d"Upgrades %[T]% [setuphost] %toggle%" /f %.%


reg add"%menu%shell3Upgradescommand" /ve /d"%task%upgrades" /f %.%


call :status wuauclt


reg add"%menu%shell4Installs" /v MUIVerb /d"Installs %[T]% [wuauclt] %toggle%" /f %.%


reg add"%menu%shell4Installscommand" /ve /d"%task%installs" /f %.%


for /f"tokens=3" %%# in ('sc qc TrustedInstaller ^| find /I"WUTblocked"') do set"blocked=%%#"


if /i"%blocked%"=="[WUTblocked]" (set"toggle=blocked") else set"toggle=enabled"


reg add"%menu%shell5Downloads" /v MUIVerb /d"Downloads ( ! ) %[T]% [trustedinstaller] %toggle%" /f %.%


reg add"%menu%shell5Downloadscommand" /ve /d"%task%downloads" /f %.%


for /f"tokens=3" %%# in ('sc qc wuauserv ^| find /I"WUTblocked"') do set"blocked=%%#"


if /i"%blocked%"=="rpcss[WUTblocked]" (set"toggle=blocked") else set"toggle=enabled"


reg add"%menu%shell6Service" /v MUIVerb /d"Service ( ! ) %[T]% [wuauserv] %toggle%" /f %.%


reg add"%menu%shell6Servicecommand" /ve /d"%task%service" /f %.%


call :status wermgr


reg add"%menu%shell81Report" /v MUIVerb /d"Report %[T]% %toggle%" /f %.%


reg add"%menu%shell81Reportcommand" /ve /d"%task%report" /f %.%


call :status SpeechRuntime


reg add"%menu%shell82Speech" /v MUIVerb /d"Speech %[T]% %toggle%" /f %.%


reg add"%menu%shell82Speechcommand" /ve /d"%task%speech" /f %.%


call :status SearchUI


reg add"%menu%shell83Search" /v MUIVerb /d"SearchUI %[T]% %toggle%" /f %.%


reg add"%menu%shell83Searchcommand" /ve /d"%task%search" /f %.%


set"defstatus=if((Get-MpPreference).DisableRealtimeMonitoring){write-host stopped}else{write-host enabled}"


for /f"delims=" %%# in ('call powershell.exe -c"%defstatus%;"') do set"toggle=%%#"


reg add"%menu%shell84Defender" /v MUIVerb /d"Defender %[T]% %toggle%" /f %.%


reg add"%menu%shell84Defendercommand" /ve /d"%task%defender" /f %.%


if"%norefresh%"=="Enable" reg delete"%menu%0pending" /f %.%


exit/b



:toggle WUT


echo %0 %*


call :reg_query"HKLMSOFTWAREWUT.bat" NoBlock noblock


if"%noblock%"=="Disable" (set"toggle=Enable") else set"toggle=Disable"


for %%# in (NoBlock NoRefresh) do reg add"HKLMSOFTWAREWUT.bat" /v %%# /d"%toggle%" /f %.%


:: Generate WUT main context menu


for %%# in ("""0pending""1hide""2unhide""3apply") do reg delete"%menu%%%~#" /f %.%


reg add"%menu%" /v MUIVerb /d"Windows Update Toggle" /f %.%


reg add"%menu%" /v Icon /d"appwiz.cpl,5" /f %.%


reg add"%menu%" /v SubCommands /d"" /f %.%


reg add"%menu%shell9Setup" /v MUIVerb /d"windows_update_toggle.bat v10.0" /f %.%


reg add"%menu%shell9Setup" /v SubCommands /d"" /f %.%


reg add"%menu%shell9Setupshell1Toggle" /v MUIVerb /d"%toggle%" /f %.%


reg add"%menu%shell9Setupshell2Renew" /v MUIVerb /d"Renew" /f %.%


reg add"%menu%shell9Setupshell3Remove" /v MUIVerb /d"Remove" /f %.%


reg add"%menu%shell9Setupshell1Togglecommand" /ve /d"%task%toggle" /f %.%


reg add"%menu%shell9Setupshell2Renewcommand" /ve /d"%task%renew" /f %.%


reg add"%menu%shell9Setupshell3Removecommand" /ve /d"%task%remove" /f %.%


if"%toggle%"=="Disable" (


 reg add"%menu%shell1Refresh" /v MUIVerb /d"Refresh" /f %.%


 reg add"%menu%shell1Refreshcommand" /ve /d"%task%refresh" /f %.%


 reg add"%menu%shell2Lists" /v MUIVerb /d"Hide / Unhide / Apply %[T]% enabled" /f %.%


 reg add"%menu%shell2Listscommand" /ve /d"%task%lists" /f %.%


 reg add"%menu%shell7Repair" /v MUIVerb /d"Troubleshooter" /f %.%


 reg add"%menu%shell7Repaircommand" /ve /d"%task%repair" /f %.%


)


:: Disabling automatic updates hinders Defender, so get definitions from MMPC first


if"%toggle%"=="Enable" ( set"DefSig=%DefMUS%" ) else set"DefSig=%DefMMPC%"


start"WUT:MpPref" wscript /e:JScript"%~f0" cmd"powershell.exe -c `Set-MpPreference -SignatureFallbackOrder %DefSig%;`"


:: Default services


sc config wuauserv type= share depend= rpcss %.%


sc config TrustedInstaller type= own depend= / %.%


:: Toggle ifeo exe blocking


for %%# in (%exe% %speech% %search%) do reg delete"%ifeo%%%#.exe" /f %.%


if"%toggle%"=="Enable" exit/b WUT disabled, so skip the code below


for %%# in (%exe%) do reg add"%ifeo%%%#.exe" /v Debugger /d"%noop%" /f %.% &taskkill /im"%%#.exe" /t /f %.%


:: WUTRefresh hijacking


for %%# in (MusNotification EOSNotify) do reg add"%ifeo%%%#.exe" /v Debugger /d"%SystemRoot%WUTRefresh.bat" /f %.%


call :refresh menu


exit/b



:hide update


echo %0 %*


call :reg_query"%menu%1hideshell%~1" MUIVerb updatefound


echo -%updatefound%


if not defined updatefound exit/b


call wscript /e:JScript"%f0%" hide"%updatefound%"


exit/b



:unhide update


echo %0 %*


call :reg_query"%menu%2unhideshell%~1" MUIVerb updatefound


echo -%updatefound%


if not defined updatefound exit/b


call wscript /e:JScript"%f0%" unhide"%updatefound%"


exit/b



:apply update


echo %0 %*


call :reg_query"%menu%3applyshell%~1" MUIVerb updatefound


echo -%updatefound%


if not defined updatefound exit/b


:: Temporarily unblock downloads and installs


call :reg_query"%ifeo%wuauclt.exe" Debugger installs_blocked


for /f"tokens=3" %%# in ('sc qc TrustedInstaller ^| find /I"WUTblocked"') do set"downloads_blocked=%%#"


call wscript /e:JScript"%f0%" apply"%updatefound%"


:: Restore block


if defined installs_blocked reg add"%ifeo%wuauclt.exe" /v Debugger /d"%noop%" /f %.% &taskkill /im"wuauclt.exe" /t /f %.%


if defined downloads_blocked sc config TrustedInstaller type= own depend= [WUTblocked] %.%


exit/b



:lists


echo %0 %*


call :reg_query"HKLMSOFTWAREWUT.bat" NoRefresh norefresh


if"%norefresh%"=="Disable" ( set"norefresh=Enable" &set"toggle=disabled") else set"norefresh=Disable" &set"toggle=enabled"


reg add"HKLMSOFTWAREWUT.bat" /v NoRefresh /d"%norefresh%" /f %.%


reg add"%menu%shell2Lists" /v MUIVerb /d"Hide / Unhide / Apply %[T]% %toggle%" /f %.%


reg add"%menu%shell1Refresh" /v MUIVerb /d"Refresh" /f %.%


reg add"%menu%shell1Refreshcommand" /ve /d"%task%refresh" /f %.%


if"%norefresh%"=="Enable" (


 reg delete"%menu%0pending" /f %.% &reg delete"%menu%1hide" /f %.% &reg delete"%menu%2unhide" /f %.%


 reg delete"%menu%3apply" /f %.% &reg delete"%menu%shell1Refresh" /f %.%


)


call :refresh lists


exit/b



:upgrades


echo %0 %*


call :flip SetupHost


reg add"%menu%shell3Upgrades" /v MUIVerb /d"Upgrades %[T]% [setuphost] %toggle%" /f %.%


for %%# in (%upgrader%) do if defined block (


 reg delete"%ifeo%%%#.exe" /f %.%


) else (


 reg add"%ifeo%%%#.exe" /v Debugger /d"%noop%" /f %.% &taskkill /im"%%#.exe" /t /f %.%


)


exit/b



:installs


echo %0 %*


call :flip wuauclt


reg add"%menu%shell4Installs" /v MUIVerb /d"Installs %[T]% [wuauclt] %toggle%" /f %.%


for %%# in (%installer%) do if defined block (


 do reg delete"%ifeo%%%#.exe" /f %.% &start"wt" wscript /e:JScript"%f0%" WUTRefresh


) else (


 reg add"%ifeo%%%#.exe" /v Debugger /d"%SystemRoot%WUTRefresh.bat" /f %.% &taskkill /im"%%#.exe" /t /f %.%


)


exit/b



:downloads


echo %0 %*


call :reg_query"%menu%3apply" MUIVerb pending


set"reboot=%pending:reboot=%"


if defined pending if"%pending%"=="%reboot%" set"pending="


if defined pending (


 sc config TrustedInstaller type= own depend= / %.%


 reg add"%menu%shell5Downloads" /v MUIVerb /d"Downloads ( ! ) %[T]% [trustedinstaller] reboot?" /f %.%


 exit/b


)


for /f"tokens=3" %%# in ('sc qc TrustedInstaller ^| find /I"WUTblocked"') do set"blocked=%%#"


if /i"%blocked%"=="[WUTblocked]" (set"blocked=/") else set"blocked=[WUTblocked]"


net stop TrustedInstaller /y %.%


for /f"tokens=3" %%# in ('sc queryex TrustedInstaller ^| find /i"PID"') do set"pid=%#"


if not"%pid%"=="0" taskkill /pid %pid% /f %.%


sc config TrustedInstaller type= own depend= %blocked% %.%


tasklist /svc | find /i"TrustedInstaller" %.%


if errorlevel 1 net start TrustedInstaller /y %.%


if errorlevel 1 (set"toggle=blocked") else set"toggle=enabled"


reg add"%menu%shell5Downloads" /v MUIVerb /d"Downloads ( ! ) %[T]% [trustedinstaller] %toggle%" /f %.%


if"%toggle%"=="enabled" start"WUT" wscript /e:JScript"%f0%" WUTRefresh


exit/b



:service


echo %0 %*


for /f"tokens=3" %%# in ('sc qc wuauserv ^| find /I"WUTblocked"') do set"blocked=%%#"


if /i"%blocked%"=="rpcss[WUTblocked]" (set"blocked=rpcss") else set"blocked=rpcss[WUTblocked]"


net stop wuauserv /y %.%


for /f"tokens=3" %%# in ('sc queryex wuauserv ^| find /i"PID"') do set"pid=%#"


if not"%pid%"=="0" taskkill /pid %pid% /f %.%


sc config wuauserv type= share depend= %blocked% %.%


tasklist /svc | find /i"wuauserv" %.%


if errorlevel 1 net start wuauserv /y %.%


if errorlevel 1 (set"toggle=blocked") else set"toggle=enabled"


reg add"%menu%shell6Service" /v MUIVerb /d"Service ( ! ) %[T]% [wuauserv] %toggle%" /f %.%


if"%toggle%"=="enabled" start"WUT" wscript /e:JScript"%f0%" WUTRefresh


exit/b



:repair


echo %0 %*


:: Restore services (undo only the changes made by this script, not whatever blocking was done by other means)


sc config wuauserv type= share depend= rpcss %.%


sc config TrustedInstaller type= own depend= / %.%


:: Remove any IFEO blocking done by past scripts


set eo=DiagnosticsHub.StandardCollector.Service WindowsUpdateElevatedInstaller LocationNotificationWindows InstallAgentUserBroker


set eo=%eo% UpdateNotificationMgr DataUsageLiveTileTask Windows10UpgraderApp WindowsActionDialog SpeechModelDownload WerFaultSecure


set eo=%eo% GetCurrentRollback WindowsUpdateBox Windows10Upgrade TrustedInstaller MusNotification DiagTrackRunner CompatTelRunner


set eo=%eo% WinREBootApp64 WinREBootApp32 UNPUXLauncher SpeechRuntime MusNotifyIcon PilotshubApp InstallAgent dstokenclean wsqmcons


set eo=%eo% disksnapshot osrssupdate wuapihost WaaSMedic UsoClient UNPUXHost SIHClient setupprep SetupHost osrssinst EOSNotify wusa


set eo=%eo% WerFault TiWorker SearchUI DWTRIG20 dusmtask dmclient appidtel wuauclt wermgr DFDWiz remsh reach HxTsr DWWIN DW20 GWX


for %%# in (%eo%) do reg delete"%ifeo%%%#.exe" /f %.%


:: Restore notification hijacking


>"%SystemRoot%WUTRefresh.bat" echo/@start"WUTRefresh" /min wscript.exe /e:JScript"%f0%" WUTRefresh


for %%# in (MusNotification EOSNotify) do reg add"%ifeo%%%#.exe" /v Debugger /d"%SystemRoot%WUTRefresh.bat" /f %.%


:: Remove pending instance safeguard


reg delete"HKLMSOFTWAREWUT.bat" /v Pending /f %.%


:: Refresh menu


call :refresh repair


:: Open Update Diagnostic


start"wud" msdt.exe /id WindowsUpdateDiagnostic %.%


:: Open official update troubleshooter page


start https://support.microsoft.com/en-us/help/4027322/windows-update-troubleshooter %.%


exit/b



:report


echo %0 %*


call :flip wermgr


reg add"%menu%shell81Report" /v MUIVerb /d"Report %[T]% %toggle%" /f %.%


for %%# in (%reporter%) do if defined block ( reg delete"%ifeo%%%#.exe" /f %.% ) else (


 reg add"%ifeo%%%#.exe" /v Debugger /d"%noop%" /f %.% &taskkill /im"%%#.exe" /t /f %.%


)


exit/b



:speech


echo %0 %*


call :flip SpeechRuntime


reg add"%menu%shell82Speech" /v MUIVerb /d"Speech %[T]% %toggle%" /f %.%


for %%# in (%speecher%) do if defined block ( reg delete"%ifeo%%%#.exe" /f %.% ) else (


 reg add"%ifeo%%%#.exe" /v Debugger /d"%noop%" /f %.% &taskkill /im"%%#.exe" /t /f %.%


)


exit/b



:search


echo %0 %*


call :flip SearchUI


reg add"%menu%shell83Search" /v MUIVerb /d"SearchUI %[T]% %toggle%" /f %.%


for %%# in (%searcher%) do if defined block ( reg delete"%ifeo%%%#.exe" /f %.% ) else (


 reg add"%ifeo%%%#.exe" /v Debugger /d"%noop%" /f %.% &taskkill /im"%%#.exe" /t /f %.%


)


exit/b



:defender


echo %0 %*


set"s10=$t=1;$toggle='stopped'; if((Get-MpPreference).DisableRealtimeMonitoring){$t=0;$toggle='enabled';}"


set"s11=Set-MpPreference -DisableRealtimeMonitoring $t"


set"s12=Set-MpPreference -DisableBehaviorMonitoring $t"


set"s13=Set-MpPreference -DisableIOAVProtection $t"


set"s14=write-host $toggle"


for /f"delims=" %%# in ('call powershell.exe -c"%s10%;%s11%;%s12%;%s13%;%s14%;"') do set"toggle=%%#"


reg add"%menu%shell84Defender" /v MUIVerb /d"Defender %[T]% %toggle%" /f %.%


exit/b



:update_defender - triggered from WScript to get definitions from MMPC, regardless of updates being blocked


tasklist /FI"IMAGENAME eq MpCmdRun.exe" | find".exe" %.%


if not errorlevel 1 exit/b


pushd %ProgramFiles%Windows Defender


call MpCmdRun.exe -removedefinitions -dynamicsignatures


call MpCmdRun.exe -SignatureUpdate -MMPC


exit/b



:setup


echo %0 %*


pushd %SystemRoot%


if /i"%~f0"=="%f0%" (set"initial_setup=") else copy /y"%~f0""%f0%" %.%


:: Create WUTUndo for emergencies


 >WUTUndo.bat echo/pushd %%~dp0system32config


>>WUTUndo.bat echo/reg load HKLMWUTUndo1 SOFTWARE


>>WUTUndo.bat echo/set"koff=HKLMWUTUndo1MicrosoftWindows NTCurrentVersionImage File Execution Options" ^&set"kon=%ifeo%"


>>WUTUndo.bat echo/for %%%%B in (%exe%) do for %%%%K in ("%%koff%%""%%kon%%") do reg delete"%%%%~K%%%%B.exe" /f 2^>nul


>>WUTUndo.bat echo/reg unload HKLMWUTUndo1


>>WUTUndo.bat echo/reg load HKLMWUTUndo2 SYSTEM


>>WUTUndo.bat echo/for %%%%K in (WUTUndo2 SYSTEM) do (


>>WUTUndo.bat echo/ reg delete"HKLM%%%%~KControlSet001ServicesTrustedInstaller" /v DependOnService /f 2^>nul


>>WUTUndo.bat echo/ reg delete"HKLM%%%%~KCurrentControlSetServicesTrustedInstaller" /v DependOnService /f 2^>nul


>>WUTUndo.bat echo/)


>>WUTUndo.bat echo/reg unload HKLMWUTUndo2


:: Create WUTRefresh to hijack update notifications and refresh context menu in addition to preventing forced reboots


>WUTRefresh.bat echo/@start"WUTRefresh" /min wscript.exe /e:JScript"%f0%" WUTRefresh


:: Create tasks to run context menu entries with proper access and no output window


start"WUT" wscript /e:JScript"%~f0" cmd"call `%~f0` setup_schtasks"


:: WUT options


for %%# in (NoBlock NoRefresh) do reg add"HKLMSOFTWAREWUT.bat" /v %%# /d"Enable" /f %.%


call :toggle blocking


exit/b



:setup_schtasks - no stalling separate process


set"strun=wscript.exe /e:JScript"%f0%" run%window%"


for %%t in (refresh lists upgrades installs downloads service repair report speech search defender toggle renew remove) do (


 schtasks /create /ru"%username%" /sc once /tn"WUT%%t" /tr"%strun% %%t" /st"00:00:00" /it /rl highest /f %.%


)


for %%t in (hide unhide apply) do for /l %%n in (101,1,116) do (


 schtasks /create /ru"%username%" /sc once /tn"WUT%%t%%n" /tr"%strun% %%t %%n" /st"00:00:00" /it /rl highest /f %.%


)


exit/b



:renew


echo %0 %*


echo Renewing from internet - old version saved as %SystemRoot%WUT.old


pushd %SystemRoot%


if exist WUT.new del /f /q WUT.new %.%


call wscript /e:JScript"%~f0" renew"https://pastebin.com/raw/gNsLEWJe""%SystemRoot%WUT.new"


if exist WUT.new copy /y"%f0%" WUT.old %.% &copy /y WUT.new"%f0%" %.% &del /f /q WUT.new %.%


start"WUT""%f0%" setup renew %.%


exit/b



:remove


echo %0 %*


for %%# in (NoBlock NoRefresh) do reg add"HKLMSOFTWAREWUT.bat" /v %%# /d"Disable" /f %.%


call :toggle off


reg delete"HKLMSOFTWAREWUT.bat" /f %.%


for %%# in ("""0pending""1hide""2unhide""3apply") do reg delete"%menu%%%~#" /f %.%


for %%t in (refresh lists upgrades installs downloads service repair report speech search defender toggle renew remove) do (


 schtasks /delete /tn"WUT%%t" /f %.%


)


for %%t in (hide unhide apply) do for /l %%n in (101,1,116) do schtasks /delete /tn"WUT%%t%%n" /f %.%


for %%t in (hide unhide apply) do schtasks /delete /tn"WUT%%t" /f %.%


schtasks /delete /tn"WUT" /f %.%


sc config wuauserv type= share depend= rpcss %.%


sc config TrustedInstaller type= own depend= / %.%


pushd %SystemRoot%


del /f /q WUT.bat WUT.old DefenderManualUpdate.bat WUTRefresh.bat WUTUndo.bat"%f0%" %.%


exit/b



:flip %1:exe


call :reg_query"%ifeo%%~1.exe" Debugger block


if defined block (set"toggle=enabled") else set"toggle=blocked"


exit/b



:status %1:exe


call :reg_query"%ifeo%%~1.exe" Debugger block


if defined block (set"toggle=blocked") else set"toggle=enabled"


exit/b



:reg_query %1:KeyName %2:ValueName %3:OutputVariable %4:other_options[example:"/t REG_DWORD"]


setlocal & for /f"skip=2 delims=" %%s in ('reg query"%~1" /v"%~2" /z 2^>nul') do set"rq=%%s" & call set"rv=%%rq:*) =%%"


endlocal & set"%~3=%rv%" & exit/b &rem AveYo: call :reg_query"HKCUMyKey""MyValue" MyVar



::---------------------------------------------------------------------------------------------------------------------------------


:JScript_functions AveYo: Switch syntax highlighter to 'javascript'


::-------------------------------------------------------------------------------------------------------------------------------*/


f0=WSH.ScriptFullName; run=WSH.Arguments(0); args=''; for(i=1;i<WSH.Arguments.length;i++) args+='"'+WSH.Arguments(i)+'"';


function sex(exe,args){WSH.CreateObject('Shell.Application').ShellExecute(exe,args,'','',0);}; function reg(s){ sex('reg.exe',s); }



// Open external commands in new hidden cmd instance - backquotes replaced to quotes


if (run=='cmd') sex('cmd','/c '+args.replace(/`/g,'"'));



// Context menu entries trigger - elevated with no popups


if (run=='schtasks') sex('SCHTASKS.EXE','/Run /TN '+args);



// Shift to CMD if loaded by WScript - pass arguments, prevent loop, run as admin at setup, hide window at context-menu


function cmd(adm,win){WSH.CreateObject('Shell.Application').ShellExecute('cmd','/c call"'+f0+'" shift"'+f0+'"'+args,'',adm,win);}


if (run=='run') cmd('',1); if (run=='runhide') cmd('',0); if (run=='runas') cmd('runas',1); if (run=='runashide') cmd('runas',0);



if (run=='renew') {


 // renew script over internet


 try{


 downloader=WSH.CreateObject("WinHttp.WinHttpRequest.5.1");


 if (downloader===null) downloader=WSH.CreateObject("WinHttp.WinHttpRequest");


 if (downloader===null) downloader=WSH.CreateObject("MSXML2.ServerXMLHTTP");


 if (downloader===null) downloader=WSH.CreateObject("Microsoft.XMLHTTP");


 downloader.Open("GET",WSH.Arguments(1),false); downloader.Send(); oASI=downloader.ResponseBody(); downloader=undefined;


 oASO=WSH.CreateObject("ADODB.Stream"); oASO.type=1; oASO.Mode=3; oASO.Open; oASO.Write(oASI); oASI=undefined;


 oASO.SaveToFile(WSH.Arguments(2)); oASO.Close();


 }catch(e){} // supress all errors since we're working with com objects


}



// WUT Hide/Unhide/Apply lists


if (run=='WUTRefresh' || run=='hide' || run=='unhide' || run=='apply') {


 SRP=GetObject("winmgmts:StdRegProv"); pending=SRP.GetStringValue(2147483650,'SOFTWAREWUT.bat','Pending');


 if (pending===0) WSH.quit(); else SRP.SetStringValue(2147483650,'SOFTWAREWUT.bat','Pending','yes'); // prevent instances


 k='HKCRDesktopBackgroundshellWUT'; hk=k+'1hide'; uk=k+'2unhide'; ik=k+'3apply'; pk=k+'0pending'; // set list keys


 reg('delete"'+hk+'" /f'); reg('delete"'+uk+'" /f'); reg('delete"'+ik+'" /f'); // delete previous


 reg('add"'+pk+'" /v MUIVerb /d"Pending.." /f'); reg('add"'+pk+'" /v SubCommands /d"" /f'); // add Pending.. entry


 // Check for updates


 count=0; wuthide=[]; wutunhide=[];


 try{


 session=WSH.CreateObject("Microsoft.Update.Session"); reboot=WSH.CreateObject("Microsoft.Update.SystemInfo").RebootRequired;


 searcher=session.CreateUpdateSearcher();


 sresult=searcher.Search("IsInstalled=0"); Updatelist=sresult.Updates; count=sresult.Updates.Count;


 for(i=0;i<count;i++) {


 itemTitle=Updatelist.Item(i).Title;


 minsize=Updatelist.Item(i).MinDownloadSize; maxsize=Updatelist.Item(i).MaxDownloadSize; wutsize='';


 if (maxsize > 1073741824) wutsize=' ['+Math.round(minsize/10737418.24)/100+' - '+Math.round(maxsize/10737418.24)/100+'GB]';


 else if (maxsize > 1048576) wutsize=' ['+Math.round(minsize/10485.76)/100+' - '+Math.round(maxsize/10485.76)/100+'MB]';


 else if (maxsize > 1024) wutsize=' ['+Math.round(minsize/10.24)/100+' - '+Math.round(maxsize/10.24)/100+'KB]';


 else if (maxsize > 0) wutsize=' ['+(minsize)+' - '+(maxsize)+'B]';


 wutTitle=Updatelist.Item(i).Title + wutsize;


 if (run=='apply' && WSH.Arguments(1).indexOf(itemTitle) > -1) {


 // Add matching entry to UpdateColl


 UpdateColl=WSH.CreateObject("Microsoft.Update.UpdateColl"); UpdateColl.Add(Updatelist.Item(i));


 // Download update


 downloader=session.CreateUpdateDownloader(); downloader.Updates=UpdateColl; dresult=downloader.Download();


 if (dresult.ResultCode==2) {


 // Unblock apply


 sex('sc','config TrustedInstaller type= own depend= /');


 KeyPath='SOFTWAREMicrosoftWindows NTCurrentVersionImage File Execution Optionswuauclt.exe';


 SRP.DeleteKey(2147483650,KeyPath);


 WSH.Sleep(1000);


 //Apply update


 installer=session.CreateUpdateInstaller(); installer.Updates=UpdateColl; iresult=installer.Install();


 if (iresult.ResultCode==2) continue;


 }


 }


 // hide and unhide are very simple bool flip compared to apply


 if (run=='hide' && WSH.Arguments(1).indexOf(itemTitle) > -1) {


 Updatelist.Item(i).IsHidden=true; wutunhide.push(wutTitle); continue;


 }


 if (run=='unhide' && WSH.Arguments(1).indexOf(itemTitle) > -1) {


 Updatelist.Item(i).IsHidden=false; wuthide.push(wutTitle); continue;


 }


 // Trigger :update_defender to manually refresh definitions from MMPC


 if (Updatelist.Item(i).IsHidden===false && itemTitle.indexOf('(Definition') > -1) {


 sex('cmd','/c call"'+f0+'" update_defender');


 }


 // Sorting lists


 if (Updatelist.Item(i).IsHidden) wutunhide.push(wutTitle); else wuthide.push(wutTitle);


 }


 // Generate Hide context menu


 if (wuthide.length>0){


 for(i=101,n=wuthide.length+101;i<n;i++) {


 reg('add"'+hk+'shell'+i+'" /v MUIVerb /d"'+wuthide[i-101]+'" /f');


 reg('add"'+hk+'shell'+i+'command" /ve /d"wscript.exe /e:JScript"'+f0+'" schtasks WUThide'+i+'" /f');


 }


 reg('add"'+hk+'" /v SubCommands /d"" /f');


 reg('add"'+hk+'" /v MUIVerb /d"Hide '+"t"+wuthide.length+'" /f');


 }


 // Generate Unhide context menu


 if (wutunhide.length>0){


 for(i=101,n=wutunhide.length+101;i<n;i++) {


 reg('add"'+uk+'shell'+i+'" /v MUIVerb /d"'+wutunhide[i-101]+'" /f');


 reg('add"'+uk+'shell'+i+'command" /ve /d"wscript.exe /e:JScript"'+f0+'" schtasks WUTunhide'+i+'" /f');


 }


 reg('add"'+uk+'" /v SubCommands /d"" /f');


 reg('add"'+uk+'" /v MUIVerb /d"Unhide '+"t"+wutunhide.length+'" /f');


 }


 // Generate Apply context menu


 if (wuthide.length>0){


 for(i=101,n=wuthide.length+101;i<n;i++) {


 reg('add"'+ik+'shell'+i+'" /v MUIVerb /d"'+wuthide[i-101]+'" /f');


 reg('add"'+ik+'shell'+i+'command" /ve /d"wscript.exe /e:JScript"'+f0+'" schtasks WUTapply'+i+'" /f');


 }


 reg('add"'+ik+'" /v SubCommands /d"" /f');


 reg('add"'+ik+'" /v MUIVerb /d"Apply '+"t"+((reboot) ? 'must reboot' : wuthide.length)+'" /f');


 }


 }catch(e){} // supress all errors since we're working with com objects


 reg('delete"'+pk+'" /f'); SRP.DeleteValue(2147483650,'SOFTWAREWUT.bat','Pending'); // Remove Pending.. temporary entry


}


//



最后更新为v10.0 final。


答案6:禁用更新服务 Win+R > services.msc 双击Windows Update并将启动类型更改为Disabled,要重新启用,请返回服务并将它更改为自动,



相关文章