f4b1.com
***

Script .bat pour supprimer les notifications de mise à jour Windows 10 sous Windows 7 / 8.1

By Admin on 2017-07-15 15:09:33

Nombre de vues : 12846


Depuis la sortie du dernier système d'exploitation de Microsoft, il faut bien se rendre à l'évidence, la firme tente par tous les moyens de convaincre le plus d'utilisateurs possible de passer sous Windows 10. La pratique de forcer la main avec différents popup et l’icône de GWX.exe qui persiste à s'afficher à côté de l'heure à vraiment dérangé beaucoup de monde. Mais pas à cause de cette mise en avant en elle-même, plutôt parce qu'il est compliqué de s'affranchir de ses différentes incitations à passer sous Windows 10 alors que l'on se trouve sur Windows 7 ou 8.1.

Il est ainsi compliqué de se débarrasser facilement de ces pop-up et notifications pour installer Windows 10, je vous en avais déjà parlé dans un précédent article et le seul moyen simple était de désinstaller à la main les différentes mises à jour. Un travail assez fastidieux. Mais des bons petits gars proposent depuis quelque temps maintenant différents scripts sur le web qui permet de supprimer automatiquement l'ensemble des mises à jour et logiciel concernant Windows 10.

C'est d’autant plus pratique que ces mises à jour ont parfois tendance à s'installer toutes seules au milieu des autres ... Il suffit donc d'enregistrer le script suivant au format .bat, de le lancer en administrateur et le tour est joué ! Au revoir les messages concernant Windows 10 sous Windows 7 ou Windows 8.1 ainsi que le programme GWX.exe. De plus si vous constatez que l’icône de gwx.exe revient, ou que vous avez de nouveaux pop up pour Windows 10, il vous suffit de relancer à nouveau le script ;) Très pratique donc, vous pouvez en abuser !

  1. @echo off
  2. :: before anything, let's specify what "yes" is interpreted in your language (for takeown)
  3. for /F "tokens=3 delims= " %%G in ('reg query "hklm\system\controlset001\control\nls\language" /v Installlanguage') do (
  4. if [%%G] equ [040C] ( set yes=o ) else ( set yes=y )
  5. )
  6. :: First, we escalate privileges of the terminal
  7. :checkPrivileges
  8. NET FILE 1>NUL 2>NUL
  9. if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )
  10. :getPrivileges
  11. if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges)
  12. echo.
  13. echo Invoking UAC for Privilege Escalation
  14. setlocal DisableDelayedExpansion
  15. set "batchPath=%~0"
  16. setlocal EnableDelayedExpansion
  17. echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\OEgetPrivileges.vbs"
  18. echo args = "ELEV " >> "%temp%\OEgetPrivileges.vbs"
  19. echo For Each strArg in WScript.Arguments >> "%temp%\OEgetPrivileges.vbs"
  20. echo args = args ^& strArg ^& " " >> "%temp%\OEgetPrivileges.vbs"
  21. echo Next >> "%temp%\OEgetPrivileges.vbs"
  22. echo UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%temp%\OEgetPrivileges.vbs"
  23. "%SystemRoot%\System32\WScript.exe" "%temp%\OEgetPrivileges.vbs" %*
  24. exit /B
  25. :gotPrivileges
  26. if '%1'=='ELEV' shift /1
  27. setlocal & pushd .
  28. cd /d %~dp0
  29. :: privilege escalation OK
  30. color 0a
  31. echo GWX / GWX Schedule / Windows spy updates search & destroy
  32. echo ----------------------------------------------
  33. timeout 3
  34. color 0e
  35. :: now time to remove nasty update
  36. echo Uninstalling KB2952664 (Get Windows 10 assistant)
  37. wusa /uninstall /kb:2952664 /quiet /norestart
  38. echo Uninstalling KB2976978 (telemetry for Win8/8.1)
  39. wusa /uninstall /kb:2976978 /quiet /norestart
  40. echo Uninstalling KB2977759 (telemetry for Win7)
  41. wusa /uninstall /kb:2977759 /quiet /norestart
  42. echo Uninstalling KB2990214 (Get Windows 10 for Win7)
  43. wusa /uninstall /kb:2990214 /quiet /norestart
  44. echo Uninstalling KB3021917 (installs telemetry for CEIP)
  45. wusa /uninstall /kb:3021917 /quiet /norestart
  46. echo Uninstalling KB3022345 (telemetry)
  47. wusa /uninstall /kb:3022345 /quiet /norestart
  48. echo Uninstalling KB3035583 (GWX Notification)
  49. wusa /uninstall /kb:3035583 /quiet /norestart
  50. echo Uninstalling KB3044374 (Get Windows 10 for Win8.1)
  51. wusa /uninstall /kb:3044374 /quiet /norestart
  52. echo Uninstalling KB3068708 (telemetry)
  53. wusa /uninstall /kb:3068708 /quiet /norestart
  54. echo Uninstalling KB3075249 (telemetry for Win7/8.1)
  55. wusa /uninstall /kb:3075249 /quiet /norestart
  56. echo Uninstalling KB3080149 (telemetry for Win7/8.1)
  57. wusa /uninstall /kb:3080149 /quiet /norestart
  58. echo Uninstalling KB3112336 (New Win8.1-^>10 upgrade scenario)
  59. wusa /uninstall /kb:3112336 /quiet /norestart
  60. echo Uninstalling KB3112343 (New Win7-^>10 upgrade scenario)
  61. wusa /uninstall /kb:3112343 /quiet /norestart
  62. echo Uninstalling KB3123862 (Updated capabilities to upgrade Windows 8.1 and Windows 7)
  63. wusa /uninstall /kb:3123862 /quiet /norestart
  64. timeout 30
  65. :: then taking ownership of remnant folders
  66. echo Take control for all folders GWX
  67. timeout 3
  68. :: let's check if GWX was already removed
  69. set error=0
  70. if not exist %windir%\System32\GWX set error=%error%+1
  71. if not exist %windir%\SysWOW64\GWX set error=%error%+1
  72. if %error%==2 goto error1
  73. takeown /F %windir%\System32\GWX /A /R /D %yes%
  74. takeown /F %windir%\SysWOW64\GWX /A /R /D %yes%
  75. takeown /F %windir%\System32\Tasks\Microsoft\Windows\Setup /A /R /D %yes%
  76. echo Change rights for all folders GWX
  77. timeout 3
  78. icacls %windir%\System32\GWX /grant "%username%":(F) /T /C
  79. icacls %windir%\SysWOW64\GWX /grant "%username%":(F) /T /C
  80. icacls %windir%\System32\Tasks\Microsoft\Windows\Setup /grant "%username%":(F) /T /C
  81. :: ok, now time to kill executable and remove this shit out of our computer
  82. echo Delete all GWX files and folders
  83. timeout 3
  84. echo Before kill GWX.exe if necessary
  85. taskkill /f /t /im GWX.exe
  86. timeout 3
  87. del /F /S /Q /A %windir%\System32\GWX\*
  88. rd /S /Q %windir%\System32\GWX
  89. :: some error handling (see eof)
  90. if exist %windir%\System32\GWX goto error2
  91. del /F /S /Q /A %windir%\SysWOW64\GWX\*
  92. rd /S /Q %windir%\SysWOW64\GWX
  93. if exist %windir%\SysWOW64\GWX goto error2
  94. :: removing related sheduled tasks
  95. del /F /S /Q /A %windir%\System32\Tasks\Microsoft\Windows\Setup\*
  96. rd /S /Q %windir%\System32\Tasks\Microsoft\Windows\Setup\gwx
  97. rd /S /Q %windir%\System32\Tasks\Microsoft\Windows\Setup\GWXTriggers
  98. :: setting policy to disable GWX
  99. reg add HKLM\SOFTWARE\Policies\Microsoft\Windows\Gwx
  100. reg add HKLM\SOFTWARE\Policies\Microsoft\Windows\Gwx /v DisableGwx /t REG_DWORD /d 1
  101. :: prevent further upgrade
  102. ::reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\OSUpgrade
  103. ::reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\OSUpgrade /v AllowOSUpgrade /t REG_DWORD /v 0
  104. ::reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\OSUpgrade /v ReservationsAllowed /t REG_DWORD /v 0
  105. color 0a
  106. echo Cleaned. Don't forget to hide these updates in Windows update to prevent reappearance.
  107. echo Have a nice day.
  108. pause
  109. exit
  110. :error1
  111. color 0c
  112. echo GWX does not seems to be installed, exiting.
  113. pause
  114. exit
  115. :error2
  116. color 0c
  117. echo Cannot remove GWX folder, are you really running this as admin? exiting.
  118. pause