查看: 30|回复: 0

[Windows] 阻止windows10更新的脚本附源码

[复制链接]

280

主题

280

帖子

861

积分

高级会员

Rank: 4

积分
861
发表于 6 天前 | 显示全部楼层 |阅读模式

本帖子中包含更多资源,您需要登录才可以下载或查看更多内容!

您需要 登录 才可以下载附件,没有帐号?注册账号入驻无名

由于要安装实验室环境(带还原功能的),所以windows10的更新就变成了灾难。
从github上发现的一个脚本,经过本人测试,目前系统一切正常,从不提示更新。
需要做的操作就是:这个bat文件必须右键管理员权限运行
  1. @echo offtitle BLOCK Win10AU!
  2. mode con cols=70 lines=15
  3. color 1f
  4. echo ※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
  5. echo ※                    禁用Windows10自动更新                         ※
  6. echo ※                                                                  ※
  7. echo ※          Block Windows X Automatic Update By F1tz                ※
  8. echo ※                                                                  ※
  9. echo ※                   请先退出安全软件!                        ※
  10. echo ※           请确认右键选择“以管理员身份运行”此脚本               ※
  11. echo ※                                                                  ※
  12. echo ※         Please quit your Anti-Malware software first!            ※
  13. echo ※  Make sure Right-click on script select "Run as administrator".  ※
  14. echo ※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
  15. echo.
  16. pause
  17.  
  18. echo ※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
  19. echo ※                                                                  ※
  20. echo ※                  结束进程 / Stopping Process...                  ※
  21. echo ※                                                                  ※
  22. echo ※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
  23.  
  24. taskkill /im Windows10UpgraderApp.exe 2>nul
  25. del /f /q "%USERPROFILE%\Desktop\微软 Windows 10 易升.lnk" 2>nul
  26. del /f /q "%USERPROFILE%\Desktop\Windows 10 Update Assistant.lnk" 2>nul
  27.  
  28. echo ※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
  29. echo ※                                                                  ※
  30. echo ※           添加防火墙规则 / Adding firewall rules...              ※
  31. echo ※                                                                  ※
  32. echo ※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
  33.  
  34. netsh advfirewall firewall add rule name="Block_Windows10UpgraderApp" dir=in program="%SYSTEMDRIVE%\Windows10Upgrade\Windows10UpgraderApp.exe" action=block
  35. netsh advfirewall firewall add rule name="Block_WinREBootApp32" dir=in program="%SYSTEMDRIVE%\Windows10Upgrade\WinREBootApp32.exe" action=block
  36. netsh advfirewall firewall add rule name="Block_WinREBootApp64" dir=in program="%SYSTEMDRIVE%\Windows10Upgrade\WinREBootApp64.exe" action=block
  37. netsh advfirewall firewall add rule name="Block_bootsect" dir=in program="%SYSTEMDRIVE%\Windows10Upgrade\bootsect.exe" action=block
  38. netsh advfirewall firewall add rule name="Block_DW20" dir=in program="%SYSTEMDRIVE%\Windows10Upgrade\DW20.EXE" action=block
  39. netsh advfirewall firewall add rule name="Block_DWTRIG20" dir=in program="%SYSTEMDRIVE%\Windows10Upgrade\DWTRIG20.EXE" action=block
  40. netsh advfirewall firewall add rule name="Block_GatherOSState" dir=in program="%SYSTEMDRIVE%\Windows10Upgrade\GatherOSState.EXE" action=block
  41. netsh advfirewall firewall add rule name="Block_GetCurrentRollback" dir=in program="%SYSTEMDRIVE%\Windows10Upgrade\GetCurrentRollback.EXE" action=block
  42. netsh advfirewall firewall add rule name="Block_HttpHelper" dir=in program="%SYSTEMDRIVE%\Windows10Upgrade\HttpHelper.exe" action=block
  43. netsh advfirewall firewall add rule name="Block_UpdateAssistant" dir=in program="%SYSTEMROOT%\UpdateAssistant\UpdateAssistant.exe" action=block
  44. netsh advfirewall firewall add rule name="Block_UpdateAssistantCheck" dir=in program="%SYSTEMROOT%\UpdateAssistant\UpdateAssistantCheck.exe" action=block
  45. netsh advfirewall firewall add rule name="Block_Windows10Upgrade" dir=in program="%SYSTEMROOT%\UpdateAssistant\Windows10Upgrade.exe" action=block
  46. netsh advfirewall firewall add rule name="Block_UpdateAssistantV2" dir=in program="%SYSTEMROOT%\UpdateAssistantV2\UpdateAssistant.exe" action=block
  47. netsh advfirewall firewall add rule name="Block_UpdateAssistantCheckV2" dir=in program="%SYSTEMROOT%\UpdateAssistantV2\UpdateAssistantCheck.exe" action=block
  48. netsh advfirewall firewall add rule name="Block_Windows10UpgradeV2" dir=in program="%SYSTEMROOT%\UpdateAssistantV2\Windows10Upgrade.exe" action=block
  49.  
  50. echo ※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
  51. echo ※                                                                  ※
  52. echo ※                 设置ACL / Configurating ACL...                   ※
  53. echo ※                                                                  ※
  54. echo ※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
  55.  
  56. echo y|cacls C:\Windows\UpdateAssistant\*.exe /t /p everyone:n 2>nul
  57. echo y|cacls C:\Windows10Upgrade\*.exe /t /p everyone:n 2>nul
  58. echo.
  59. echo ※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
  60. echo ※                                                                  ※
  61. echo ※         停止Windows Update服务 / Disable Windows Update          ※
  62. echo ※                                                                  ※
  63. echo ※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
  64.  
  65. net stop wuauserv
  66. sc config wuauserv start= disabled
  67.  
  68. echo ※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
  69. echo ※                                                                  ※
  70. echo ※                   删除计划任务 / Delete task...                  ※
  71. echo ※                                                                  ※
  72. echo ※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
  73.  
  74. schtasks /delete /TN "\Microsoft\Windows\UpdateOrchestrator\UpdateAssistant" /f 2>nul
  75. schtasks /delete /TN "\Microsoft\Windows\UpdateOrchestrator\UpdateAssistantAllUsersRun" /f 2>nul
  76. schtasks /delete /TN "\Microsoft\Windows\UpdateOrchestrator\UpdateAssistantCalendarRun" /f 2>nul
  77. schtasks /delete /TN "\Microsoft\Windows\UpdateOrchestrator\UpdateAssistantWakeupRun" /f 2>nul
  78.  
  79. echo ※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
  80. echo ※                                                                  ※
  81. echo ※                 设置注册表 / Editing Registry...                 ※
  82. echo ※                                                                  ※
  83. echo ※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
  84.  
  85. del /q /f %SYSTEMDRIVE%\NAU.reg 2>nul
  86. echo Windows Registry Editor Version 5.00 >> %SYSTEMDRIVE%\NAU.reg
  87. echo.>> %SYSTEMDRIVE%\NAU.reg
  88. echo [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate]>> %SYSTEMDRIVE%\NAU.reg
  89. echo "DoNotConnectToWindowsUpdateInternetLocations"=dword:00000001 >> %SYSTEMDRIVE%\NAU.reg
  90. echo.>> %SYSTEMDRIVE%\NAU.reg
  91. echo [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU]>> %SYSTEMDRIVE%\NAU.reg
  92. echo "NoAutoUpdate"=dword:00000001>> %SYSTEMDRIVE%\NAU.reg
  93. REG IMPORT %SYSTEMDRIVE%\NAU.reg
  94. del /q /f %SYSTEMDRIVE%\NAU.reg 2>nul
  95.  
  96. echo ※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
  97. echo ※                                                                  ※
  98. echo ※                       任务结束 / All Done!                      ※
  99. echo ※                                                                  ※
  100. echo ※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
  101. pause
复制代码

这是原始地址:https://github.com/f1tz/BlockWin10AU
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表