Advertisement
Guest User

Untitled

a guest
Jun 28th, 2016
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.58 KB | None | 0 0
  1. Default Prevent Windows 10 Upgrade
  2.  
  3. This is minimal guide to handle and prevent the Windows 10 Upgrade on Windows 7 (applies to Windows 8.1 as well)
  4. that also includes the so called Telemetry updates
  5.  
  6. there is two basic ways for that:
  7. 1) block the upgrade itself, keeping related updates installed
  8. 2) remove any updates that would facilitate the upgrade
  9.  
  10. download the sample batch scripts: here or here
  11.  
  12.  
  13. = Block related Windows 10 upgrade and telemetry settings =
  14.  
  15. # Advantages:
  16. - get use of latest Windows Update Client which solves the high CPU/Memory scan issue, and perhaps the slow/stuck scan issue
  17. - seemingly make the related updates harmless (disabled), thus can safely enable Automatic Updates (as long as 'Recommended' updates option is off)
  18. - do not need to keep track of future related updates, or if a new updates version released
  19.  
  20. # Disadvantages:
  21. - no one would know what microsoft could come up with, so some blocking settings may get reverted by future updates
  22. but you can always run/schedule the blocking script after any updating operation just in case
  23.  
  24. # Script:
  25. extract W10-Block.cmd of download pack, then right-click and select 'Run as administrator'
  26. or copy the following and save as W10-Block.cmd
  27. Spoiler:
  28.  
  29. Code:
  30.  
  31. @echo off
  32. %windir%\system32\reg.exe query "HKU\S-1-5-19" 1>nul 2>nul || goto :eof
  33. echo.
  34. echo Processing Windows10 blocking tweaks
  35. reg add HKLM\SOFTWARE\Policies\Microsoft\Windows\Gwx /v DisableGwx /t REG_DWORD /d 1 /f >nul 2>&1
  36. reg add HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate /v DisableOSUpgrade /t REG_DWORD /d 1 /f >nul 2>&1
  37. reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\OSUpgrade /v AllowOSUpgrade /t REG_DWORD /d 0 /f >nul 2>&1
  38. reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\OSUpgrade /v ReservationsAllowed /t REG_DWORD /d 0 /f >nul 2>&1
  39. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /f /v IncludeRecommendedUpdates /t REG_DWORD /d 0 >nul 2>&1
  40. reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Appraiser" /v HaveUploadedForTarget /t REG_DWORD /d 1 /f >nul 2>&1
  41. reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\AIT" /v AITEnable /t REG_DWORD /d 0 /f >nul 2>&1
  42. reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\ClientTelemetry" /v DontRetryOnError /t REG_DWORD /d 1 /f >nul 2>&1
  43. reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\ClientTelemetry" /v IsCensusDisabled /t REG_DWORD /d 1 /f >nul 2>&1
  44. reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\ClientTelemetry" /v TaskEnableRun /t REG_DWORD /d 1 /f >nul 2>&1
  45. reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags" /v UpgradeEligible /f >nul 2>&1
  46. reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v OSUpgradePendingReboot /f >nul 2>&1
  47. reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired" /f >nul 2>&1
  48. reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\Volatile" /v OSUpgradeStartTime /f >nul 2>&1
  49. reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\OSUpgrade" /v AutoRebootDelay /f >nul 2>&1
  50. reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\OSUpgrade" /v KickoffDownload /f >nul 2>&1
  51. reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\OSUpgrade" /v KickoffUpgrade /f >nul 2>&1
  52. reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\OSUpgrade\State" /f >nul 2>&1
  53. reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Reporting\EventCache.v2\Legacy\9482f4b4-e343-43b6-b170-9a65bc822c77" /f >nul 2>&1
  54. sc.exe config DiagTrack start= disabled >nul 2>&1
  55. sc.exe stop DiagTrack >nul 2>&1
  56. schtasks /Change /TN "\Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser" /DISABLE >nul 2>&1
  57. schtasks /Change /TN "\Microsoft\Windows\Application Experience\ProgramDataUpdater" /DISABLE >nul 2>&1
  58. schtasks /Change /TN "\Microsoft\Windows\Application Experience\AitAgent" /DISABLE >nul 2>&1
  59. schtasks /Change /TN "\Microsoft\Windows\Setup\gwx\launchtrayprocess" /DISABLE >nul 2>&1
  60. schtasks /Change /TN "\Microsoft\Windows\Setup\gwx\refreshgwxconfig" /DISABLE >nul 2>&1
  61. schtasks /Change /TN "\Microsoft\Windows\Setup\gwx\refreshgwxconfigandcontent" /DISABLE >nul 2>&1
  62. schtasks /Change /TN "\Microsoft\Windows\Setup\gwx\refreshgwxcontent" /DISABLE >nul 2>&1
  63. schtasks /Delete /F /TN "\Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser" >nul 2>&1
  64. schtasks /Delete /F /TN "\Microsoft\Windows\Application Experience\ProgramDataUpdater" >nul 2>&1
  65. schtasks /Delete /F /TN "\Microsoft\Windows\Application Experience\AitAgent" >nul 2>&1
  66. schtasks /Delete /F /TN "\Microsoft\Windows\Setup\gwx\launchtrayprocess" >nul 2>&1
  67. schtasks /Delete /F /TN "\Microsoft\Windows\Setup\gwx\refreshgwxconfig" >nul 2>&1
  68. schtasks /Delete /F /TN "\Microsoft\Windows\Setup\gwx\refreshgwxconfigandcontent" >nul 2>&1
  69. schtasks /Delete /F /TN "\Microsoft\Windows\Setup\gwx\refreshgwxcontent" >nul 2>&1
  70. (echo schtasks /Change /TN "\Microsoft\Windows\Setup\GWXTriggers\refreshgwxconfig-B" /DISABLE
  71. echo schtasks /Change /TN "\Microsoft\Windows\Setup\GWXTriggers\Logon-5d" /DISABLE
  72. echo schtasks /Change /TN "\Microsoft\Windows\Setup\GWXTriggers\Logon-URT" /DISABLE
  73. echo schtasks /Change /TN "\Microsoft\Windows\Setup\GWXTriggers\MachineUnlock-5d" /DISABLE
  74. echo schtasks /Change /TN "\Microsoft\Windows\Setup\GWXTriggers\OutOfIdle-5d" /DISABLE
  75. echo schtasks /Change /TN "\Microsoft\Windows\Setup\GWXTriggers\OutOfSleep-5d" /DISABLE
  76. echo schtasks /Change /TN "\Microsoft\Windows\Setup\GWXTriggers\ScheduleUpgradeReminderTime" /DISABLE
  77. echo schtasks /Change /TN "\Microsoft\Windows\Setup\GWXTriggers\ScheduleUpgradeTime" /DISABLE
  78. echo schtasks /Change /TN "\Microsoft\Windows\Setup\GWXTriggers\Telemetry-4xd" /DISABLE
  79. echo schtasks /Change /TN "\Microsoft\Windows\Setup\GWXTriggers\Time-5d" /DISABLE
  80. echo schtasks /Delete /F /TN "\Microsoft\Windows\Setup\GWXTriggers\refreshgwxconfig-B"
  81. echo schtasks /Delete /F /TN "\Microsoft\Windows\Setup\GWXTriggers\Logon-5d"
  82. echo schtasks /Delete /F /TN "\Microsoft\Windows\Setup\GWXTriggers\Logon-URT"
  83. echo schtasks /Delete /F /TN "\Microsoft\Windows\Setup\GWXTriggers\MachineUnlock-5d"
  84. echo schtasks /Delete /F /TN "\Microsoft\Windows\Setup\GWXTriggers\OutOfIdle-5d"
  85. echo schtasks /Delete /F /TN "\Microsoft\Windows\Setup\GWXTriggers\OutOfSleep-5d"
  86. echo schtasks /Delete /F /TN "\Microsoft\Windows\Setup\GWXTriggers\ScheduleUpgradeReminderTime"
  87. echo schtasks /Delete /F /TN "\Microsoft\Windows\Setup\GWXTriggers\ScheduleUpgradeTime"
  88. echo schtasks /Delete /F /TN "\Microsoft\Windows\Setup\GWXTriggers\Telemetry-4xd"
  89. echo schtasks /Delete /F /TN "\Microsoft\Windows\Setup\GWXTriggers\Time-5d")>%windir%\Tasks.cmd
  90. SCHTASKS /Create /F /RU "SYSTEM" /RL HIGHEST /SC HOURLY /TN Tasks /TR "cmd /c %windir%\Tasks.cmd" >nul 2>&1
  91. SCHTASKS /Run /I /TN Tasks >nul 2>&1
  92. TIMEOUT /T 5 >nul 2>&1
  93. SCHTASKS /Delete /F /TN Tasks >nul 2>&1
  94. del /f /q %windir%\Tasks.cmd >nul 2>&1
  95.  
  96.  
  97.  
  98. Note:
  99. - some of the commands may return error (task or registry key not found), you can ignore that
  100.  
  101. # Schedule task:
  102. to make sure the blocking settings are always set, you can create a schedule task to run the script at logon as example
  103. 1- copy W10-Block.cmd to C:\Windows directory
  104. 2- open command prompt as administrator and execute:
  105. Code:
  106.  
  107. SCHTASKS /Create /F /RU "SYSTEM" /RL HIGHEST /SC ONLOGON /TN BlockW10 /TR "cmd /c %windir%\W10-Block.cmd"
  108. SCHTASKS /Run /I /TN BlockW10
  109.  
  110.  
  111. = Remove related Windows 10 upgrade and telemetry updates =
  112.  
  113. # Advantages:
  114. - safely make sure the upgrade do not sneak in
  115. - get rid of any telemetry effects (tracking, spying)
  116.  
  117. # Disadvantages:
  118. - needs constant tracking of all future updates to determine which are related or harmful
  119. - Automatic Updates can cause related updates to be installed, specially for new versions of known updates
  120. - skipping latest Windows Update Client which solves the slow/high-resources scans
  121.  
  122. 1) Uninstall updates:
  123. extract W10-Uninstall.cmd of download pack, then right-click and select 'Run as administrator'
  124. or copy the following and save as W10-Uninstall.cmd
  125. Spoiler:
  126. Code:
  127.  
  128. @echo off
  129. set list=(2952664,2976978,2990214,3021917,3022345,3035583,3044374,3050265,3050267,3064683,3068708,3072318,3075249,3075851,3075853,3080149,3083324,3083325,3083710,3083711,3102810,3102812,3112336,3112343,3121461,3123862,3135445,3135449,3138612,3138615,3150513)
  130.  
  131. %windir%\system32\reg.exe query "HKU\S-1-5-19" 1>nul 2>nul || goto :eof
  132. setlocal enableextensions
  133. setLocal EnableDelayedExpansion
  134. cd /d "%~dp0"
  135. set name=
  136. echo.
  137. echo Checking installed packages...
  138. Dism /English /Online /Get-Packages>Packs.txt
  139. for /d %%G in %list% do (
  140. for /f "tokens=3 delims=: " %%i in ('findstr %%G Packs.txt') do echo %%i>>ToRemove.txt
  141. )
  142. if not exist ToRemove.txt echo.&echo Non of the specified updates is found installed&goto :end
  143. for /f %%i in (ToRemove.txt) do (call set /a num+=1)
  144. for /f %%i in (ToRemove.txt) do call :setcount %%i
  145. for /L %%j in (1, 1, %num%) do (
  146. set name=!name! /PackageName:!PK%%j!
  147. )
  148. Dism /Online /NoRestart /Remove-Package %name%
  149. del ToRemove.txt
  150. echo.
  151. echo #########################################################
  152. if exist "%windir%\winsxs\pending.xml" echo.&echo System restart is required.
  153.  
  154. :end
  155. del Packs.txt
  156. echo.
  157. echo.
  158. echo Press any key to Exit
  159. pause >nul
  160. exit
  161.  
  162. :setcount
  163. set /a count+=1
  164. set PK%count%=%1
  165. goto :eof
  166.  
  167.  
  168.  
  169. Notes:
  170. - the script will need updating when new related updates are released, by appending KB numbers to the list in second line
  171. - for Windows 8.1, if the OS is installed using latest released ISO/ESD (December 2014), it contain a version of KB2976978 that is permanent and can't be removed
  172. the only workaround left is to disable/delete its related tasks:
  173. Spoiler:
  174. Code:
  175.  
  176. schtasks /Change /TN "\Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser" /DISABLE
  177. schtasks /Change /TN "\Microsoft\Windows\Application Experience\ProgramDataUpdater" /DISABLE
  178. schtasks /Change /TN "\Microsoft\Windows\Application Experience\AitAgent" /DISABLE
  179. schtasks /Delete /F /TN "\Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser"
  180. schtasks /Delete /F /TN "\Microsoft\Windows\Application Experience\ProgramDataUpdater"
  181. schtasks /Delete /F /TN "\Microsoft\Windows\Application Experience\AitAgent"
  182.  
  183.  
  184.  
  185. 2) Hide updates:
  186. extract W10-Hide.cmd of download pack, then right-click and select 'Run as administrator'
  187. or copy the following and save as W10-Hide.cmd
  188. Spoiler:
  189. Code:
  190.  
  191. @echo off
  192. set "list=2952664 2976978 2990214 3021917 3022345 3035583 3044374 3050265 3050267 3064683 3068708 3072318 3075249 3075851 3075853 3080149 3083324 3083325 3083710 3083711 3102810 3102812 3112336 3112343 3121461 3123862 3135445 3135449 3138612 3138615 3150513"
  193.  
  194. %windir%\system32\reg.exe query "HKU\S-1-5-19" 1>nul 2>nul || goto :eof
  195. cd /d "%~dp0"
  196. (echo Dim objArgs
  197. echo Set objArgs ^= Wscript.Arguments
  198. echo Dim updateSession, updateSearcher
  199. echo Set updateSession ^= CreateObject^("Microsoft.Update.Session"^)
  200. echo Set updateSearcher ^= updateSession.CreateUpdateSearcher^(^)
  201. echo Wscript.Stdout.Write "Checking for updates..."
  202. echo Dim searchResult
  203. echo Set searchResult ^= updateSearcher.Search^("IsInstalled=0"^)
  204. echo Dim update, kbArticleId, index, index2
  205. echo WScript.Echo " "
  206. echo WScript.Echo " "
  207. echo For index ^= ^0 To searchResult.Updates.Count ^- ^1
  208. echo Set update ^= searchResult.Updates.Item^(index^)
  209. echo For index2 ^= ^0 To update.KBArticleIDs.Count - ^1
  210. echo kbArticleId ^= update.KBArticleIDs^(index2^)
  211. echo For Each hotfixId in objArgs
  212. echo If kbArticleId ^= hotfixId Then
  213. echo If update.IsHidden ^= False Then
  214. echo WScript.Echo "Hiding update: " ^& update.Title
  215. echo update.IsHidden ^= True
  216. echo Else
  217. echo WScript.Echo "Already hidden: " ^& update.Title
  218. echo End If
  219. echo End If
  220. echo Next
  221. echo Next
  222. echo Next
  223. echo.)>Hide.vbs
  224. echo.
  225. cscript.exe //Nologo Hide.vbs %list%
  226. echo.
  227. echo.
  228. echo Press any key to Exit
  229. pause >nul
  230. del Hide.vbs
  231. exit
  232.  
  233.  
  234.  
  235. Notes:
  236. - the script will need updating when new related updates are released, by appending KB numbers to the list in second line
  237. - the hiding operation depend on checking updates using WU api, therefore the process may take some time specially on fresh system with no updates installed
  238. - thanks to MysTikAL3 for original HideUpdates.vbs
  239.  
  240. 3) Extra:
  241. if you suspect or found that there upgrade related files downloaded, you may run these commands in admin cmd to clean them up
  242. Spoiler:
  243.  
  244. Code:
  245.  
  246. del /f /s /q %windir%\SoftwareDistribution\Download\* >nul 2>&1
  247. for /f %i in ('"dir /s /b /ad %systemroot%\SoftwareDistribution\Download" 2^>nul') do rmdir /S /Q %i 1>nul 2>nul
  248. takeown /f %SystemDrive%\$WINDOWS.~BT\* /R /A >nul 2>&1
  249. icacls %SystemDrive%\$WINDOWS.~BT\*.* /grant *S-1-5-32-544:F /T >nul 2>&1
  250. rmdir /S /Q %SystemDrive%\$WINDOWS.~BT >nul 2>&1
  251. takeown /f %SystemDrive%\$Windows.~WS\* /R /A >nul 2>&1
  252. icacls %SystemDrive%\$Windows.~WS\*.* /grant *S-1-5-32-544:F /T >nul 2>&1
  253. rmdir /S /Q %SystemDrive%\$Windows.~WS >nul 2>&1
  254.  
  255.  
  256.  
  257. - You may follow these changelogs to track which updates are Windows10 related: W8.1 - W7
  258. - See here for more info on what KB update is for
  259.  
  260. Last edited by abbodi1406; 11 May 2016 at 14:52. Reason: added 3150513
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement