pf100

WumtWrapperScript-2.3.7

Jun 16th, 2018
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.66 KB | None | 0 0
  1. @echo off
  2. Title WUMT Wrapper Script 2.3.7
  3. Color 1F & goto start
  4. Original script by pf100 @ MDL with special thanks to rpo and abbodi1406 @ MDL for code improvements.
  5. Project page and source code:
  6. https://forums.mydigitallife.net/threads/72203-WUMT-Wrapper-script-controls-windows-update-service
  7. ******************************************************************
  8. You may freely modify this script as you wish, I only request that you leave the credits and the
  9. link to the original script.
  10. ******************************************************************
  11. This script provides manual updating for Windows 10 including Home versions.
  12. Update Windows 10 on your schedule, not Microsoft's.
  13. I originally wrote this script for personal use because of the lack of update options with the
  14. original RTM release of Windows 10 Pro. I wanted to update Windows 10 when I had the free time
  15. to manually update, just like I did with previous versions of Windows that allowed me to
  16. set updates to manual, not when Microsoft forced it on me while I was busy using my computer.
  17. *******************************************************************
  18. WUMT is available here: https://forums.mydigitallife.net/threads/64939-Windows-Update-MiniTool
  19. Windows Update Blocker is available here: https://www.dropbox.com/s/a67qj0qzbmx59bm/wub.exe?dl=1
  20. Only use Windows Update Blocker v1.0 with this script, not v1.1.
  21. *******************************************************************
  22. How it works: This script creates a smart Windows Defender Update task "WUD" that updates Windows
  23. Defender if it's running and enabled, and doesn't update it if it's not running and disabled,
  24. auto-elevates, uninstalls and removes the Windows 10 Update Assistant, renames the %programfiles%\rempl
  25. folder disabling remsh.exe, resets and removes permissions from and disables UsoClient.exe, WaaSMedic.exe,
  26. WaasMedicSvc.dll, WaaSMedicPS.dll, WaaSAssessment.dll, MusNotificationUx.exe, and SIHClient.exe, makes
  27. sure the task "wub_task" is installed that runs wub at boot (to stop updates from turning updates back on),
  28. runs wub.exe and enables and starts the windows update service (wuauserv) if disabled
  29. (*wub can be disabled using the included Configurator.cmd script, leaving Windows Updates always running
  30. so you can use Store and Defender at any time), then runs the correct version of the Windows Update MiniTool
  31. in "auto search for updates" mode for your OS version's architecture (x86 or x64), then disables and stops
  32. wuauserv giving you full control. No more forced automatic updates or surprise reboots. This was written
  33. for Windows 10 Pro and Home, but works with all versions of Windows 10. Don't change any settings in lower
  34. left of WUMT while running the script.
  35. *******************************************************************
  36. I also included an uninstaller.cmd that deletes the WUD and wub_task tasks, deletes the WDU.cmd file used by WUD,
  37. restores the rempl folder, resets UsoClient.exe, WaaSMedic.exe, WaasMedicSvc.dll, WaaSMedicPS.dll, MusNotificationUx.exe,
  38. WaaSAssessment.dll, and SIHClient.exe permissions to how they were originally, and turns off wub (if enabled) which
  39. turns the windows update service on automatic again, undoing everything done by the script. Running the wrapper
  40. script again undoes what the uninstaller does, and the uninstaller undoes what the wrapper script does.
  41. *******************************************************************
  42. Configurator.cmd leaves remsh.exe, UsoClient.exe, WaaSMedic.exe, WaasMedicSvc.dll, WaaSMedicPS.dll,
  43. MusNotificationUx.exe, WaaSAssessment.dll and SIHClient.exe disabled, but gives you the option of keeping the windows
  44. update service running all the time for people who want that option (use Store anytime) You can also
  45. run it again to reverse changes so that windows updates are set to fully manual but you can't use the
  46. store anytime (you can after update check before closing WUMT, or using Configurator.cmd to temporarily
  47. enable the windows update service again).
  48. *******************************************************************
  49. *If you need to install .Net 3.5 or use the Windows 10 Store or something that needs wuauserv
  50. running, run the script and after it enables wuauserv and starts WUMT, install what you need
  51. after WUMT checks for updates, before closing WUMT. If you ran the Configurator to "leave
  52. the Windows Update Service running at all times" you can ignore this note as the store will
  53. work at any time.
  54. *******************************************************************
  55. :start
  56. :::::::::::::::::::::::::::::::::::::::::
  57. :: Automatically check & get admin rights
  58. :::::::::::::::::::::::::::::::::::::::::
  59. :: ECHO.
  60. :: ECHO =============================
  61. :: ECHO Running Admin shell
  62. :: ECHO =============================
  63. :: Check Privileges
  64. :: Get Privileges
  65. :: and
  66. :: Invoke UAC for Privilege Escalation
  67. :: Notify if error escalating
  68. :: and prevent looping if escalation fails
  69. ::::::::::::::::::::::::::::
  70. set "params=Problem_with_elevating_UAC_for_Administrator_Privileges"&if exist "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs"
  71. fsutil dirty query %systemdrive% >nul 2>&1 && goto :GotPrivileges
  72. :: The following test is to avoid infinite looping if elevating UAC for Administrator Privileges failed
  73. If "%1"=="%params%" (echo Elevating UAC for Administrator Privileges failed&echo Right click on the script and select 'Run as administrator'&echo Press any key to exit...&pause>nul 2>&1&exit)
  74. cmd /u /c echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "%~0", "%params%", "", "runas", 1 > "%temp%\getadmin.vbs"&cscript //nologo "%temp%\getadmin.vbs"&exit
  75. :GotPrivileges
  76. ::::::::::::::::::::::::::::
  77. ::START
  78. ::Uninstall and remove Windows 10 Update assistant.
  79. ::Disable Windows Update Service until script menu screen.
  80. ::Reset (in case of wrong Permissions), remove Permissions from and Disable UsoClient.exe,
  81. ::WaaSMedic.exe, WaasMedicSvc.dll, WaaSMedicPS.dll, WaaSAssessment.dll, MusNotificationUx.exe, and SIHClient.exe.
  82. ::Kill remsh.exe if it's running.
  83. ::Rename the folder %ProgramFiles%\rempl to %ProgramFiles%\rempl-backup if it exists.
  84. ::Install wub_task (prevents Windows Update service from starting after installing updates and rebooting).
  85. ::Enable and start the Windows Update Service (wuauserv).
  86. ::Run the correct version of WUMT for your architecture.
  87. ::Start WUMT in "auto-check for updates" mode.
  88. ::After updates are completed and WUMT is closed and/or the "reboot"
  89. ::button in WUMT is pressed, silently run wub.exe and disable and stop wuauserv
  90. ::::::::::::::::::::::::::::
  91. @echo off
  92. cls
  93. rem Get Windows OS build number
  94. for /f "tokens=2 delims==" %%a in ('wmic path Win32_OperatingSystem get BuildNumber /value') do (
  95. set /a WinBuild=%%a)
  96. rem Test for Windows 7
  97. if %winbuild% LEQ 7601 (call "%~dp0module2.cmd" & goto StartWUMT)
  98. if exist "%systemdrive%\Windows10Upgrade\Windows10UpgraderApp.exe" ( echo Windows 10 Update Assistant detected. Preparing to uninstall.
  99. echo The "Windows 10 Update Assistant has stopped working" dialog box may pop up. If so, just close it.
  100. echo Press a key to acknowledge this and please wait for the uninstall to finish.
  101. echo Script will continue after uninstall and removal is completed...
  102. pause > nul
  103. echo Uninstalling Windows 10 Update Assistant...
  104. %systemdrive%\Windows10Upgrade\Windows10UpgraderApp.exe /forceuninstall
  105. timeout /t 10 /nobreak >nul 2>&1
  106. del %systemroot%\UpdateAssistant\*.* /f /q >nul 2>&1
  107. rmdir %systemroot%\UpdateAssistant /s /q >nul 2>&1
  108. del %SystemDrive%\Windows10Upgrade\*.* /f /q >nul 2>&1
  109. rmdir %SystemDrive%\Windows10Upgrade /s /q >nul 2>&1
  110. cls
  111. echo Windows 10 Update Assistant removed.
  112. echo Press a key to continue...
  113. pause > nul )
  114. cls
  115. ::::::::::::::::::::::::::::
  116. echo.
  117. echo Please wait...
  118. ::::::::::::::::::::::::::::
  119. del %systemroot%\UpdateAssistantV2\*.* /f /q >nul 2>&1
  120. rmdir %systemroot%\UpdateAssistantV2 /s /q >nul 2>&1
  121. ::::::::::::::::::::::::::::
  122. ::Check if update service is running or not and then delete correct file
  123. sc query | find /i "wuauserv" > nul & if errorlevel 1 (if exist "%~dp0wub.exe" del "%~dp0wub.exe-backup" /f /q >nul 2>&1
  124. ) else (
  125. if exist "%~dp0wub.exe-backup" del "%~dp0wub.exe" /f /q >nul 2>&1)
  126. ::::::::::::::::::::::::::::
  127. ::If somehow both files "wub.exe" and "wub.exe-backup" exist after the previous check, delete "wub.exe-backup"
  128. if exist "%~dp0wub.exe" if exist "%~dp0wub.exe-backup" del "%~dp0wub.exe-backup" /f /q >nul 2>&1
  129. ::::::::::::::::::::::::::::
  130. "%~dp0wub.exe" /d /p >nul 2>&1
  131. ::::::::::::::::::::::::::::
  132. ::Remove ability for the following files to be executed
  133. takeown /f "%systemroot%\System32\UsoClient.exe" /a >nul 2>&1
  134. icacls "%systemroot%\System32\UsoClient.exe" /reset >nul 2>&1
  135. icacls "%systemroot%\System32\UsoClient.exe" /inheritance:r /remove *S-1-5-32-544 *S-1-5-11 *S-1-5-32-545 *S-1-5-18 >nul 2>&1
  136. ::::::::::::::::::::::::::::
  137. takeown /f "%systemroot%\System32\WaaSMedic.exe" /a >nul 2>&1
  138. icacls "%systemroot%\System32\WaaSMedic.exe" /reset >nul 2>&1
  139. icacls "%systemroot%\System32\WaaSMedic.exe" /inheritance:r /remove *S-1-5-32-544 *S-1-5-11 *S-1-5-32-545 *S-1-5-18 >nul 2>&1
  140. ::::::::::::::::::::::::::::
  141. takeown /f "%systemroot%\System32\WaasMedicSvc.dll" /a >nul 2>&1
  142. icacls "%systemroot%\System32\WaasMedicSvc.dll" /reset >nul 2>&1
  143. icacls "%systemroot%\System32\WaasMedicSvc.dll" /inheritance:r /remove *S-1-5-32-544 *S-1-5-11 *S-1-5-32-545 *S-1-5-18 >nul 2>&1
  144. ::::::::::::::::::::::::::::
  145. takeown /f "%systemroot%\System32\WaaSMedicPS.dll" /a >nul 2>&1
  146. icacls "%systemroot%\System32\WaaSMedicPS.dll" /reset >nul 2>&1
  147. icacls "%systemroot%\System32\WaaSMedicPS.dll" /inheritance:r /remove *S-1-5-32-544 *S-1-5-11 *S-1-5-32-545 *S-1-5-18 >nul 2>&1
  148. ::::::::::::::::::::::::::::
  149. takeown /f "%systemroot%\System32\WaaSAssessment.dll" /a >nul 2>&1
  150. icacls "%systemroot%\System32\WaaSAssessment.dll" /reset >nul 2>&1
  151. icacls "%systemroot%\System32\WaaSAssessment.dll" /inheritance:r /remove *S-1-5-32-544 *S-1-5-11 *S-1-5-32-545 *S-1-5-18 >nul 2>&1
  152. ::::::::::::::::::::::::::::
  153. takeown /f "%systemroot%\System32\SIHClient.exe" /a >nul 2>&1
  154. icacls "%systemroot%\System32\SIHClient.exe" /reset >nul 2>&1
  155. icacls "%systemroot%\System32\SIHClient.exe" /inheritance:r /remove *S-1-5-32-544 *S-1-5-11 *S-1-5-32-545 *S-1-5-18 >nul 2>&1
  156. ::::::::::::::::::::::::::::
  157. takeown /f "%systemroot%\System32\MusNotificationUx.exe" /a >nul 2>&1
  158. icacls "%systemroot%\System32\MusNotificationUx.exe" /reset >nul 2>&1
  159. icacls "%systemroot%\System32\MusNotificationUx.exe" /inheritance:r /remove *S-1-5-32-544 *S-1-5-11 *S-1-5-32-545 *S-1-5-18 >nul 2>&1
  160. ::::::::::::::::::::::::::::
  161. ::Disable remsh
  162. taskkill /im remsh.exe /f >nul 2>&1
  163. if exist "%ProgramFiles%\rempl" rmdir /s /q "%ProgramFiles%\rempl-backup" >nul 2>&1
  164. ren "%ProgramFiles%\rempl" rempl-backup >nul 2>&1
  165. ::::::::::::::::::::::::::::
  166. ::Create automatic Windows Defender Update "WDU" task that updates Defender only if it's enabled and running.
  167. ::Create Windows Update Blocker "Wub_task" that sets your desired Windows Update service state at boot.
  168. pushd %~dp0
  169. cscript //nologo module.vbs >nul 2>&1
  170. cls
  171. timeout /t 1 /nobreak >nul 2>&1
  172. popd
  173. ::::::::::::::::::::::::::::
  174. echo ***********************************************
  175. echo Welcome to manual updates!
  176. echo Automatic updates are now turned off
  177. echo (unless overriden with Configurator).
  178. echo This script automates the update process
  179. echo It automatically disables a range of useless junk
  180. echo that bypasses windows update, such as:
  181. echo remsh, UsoClient, WaaSMedic, SIHClient, and Update Assistant.*
  182. echo Enables and starts only the Windows Update Service.
  183. echo Runs the Windows Update MiniTool (WUMT).
  184. echo After updates, stops and disables the Windows Update service.
  185. echo *The included uninstaller undoes script changes.*
  186. echo Closing WUMT at any time disables updates again;
  187. echo however, if WUMT is already offering updates, you
  188. echo need to hide them and/or install them one-by-one
  189. echo before closing WUMT or it may install them without
  190. echo asking next time. Don't change WUMT settings while
  191. echo running this script. If an update requires a reboot,
  192. echo re-run the script and just close the first screen
  193. echo to make sure the useless junk that forces updates
  194. echo stay off.
  195. echo Run Configurator.cmd to enable running store any time.
  196. echo ***********************************************
  197. echo. & echo Press any key to check for updates, or
  198. echo close this screen to cancel and leave updates turned off
  199. echo (unless overridden with configurator) & pause > nul
  200. :StartWUMT
  201. "%~dp0wub.exe" /e
  202. :: Check OS and run correct version of WUMT
  203. for /f "tokens=2 delims==" %%a in ('wmic cpu get AddressWidth /value') do (set arch=%%a)
  204. IF %arch% == 32 (set "wumt=%~dp0wumt_x86.exe") else (set "wumt=%~dp0wumt_x64.exe")
  205. Start "" "%wumt%" -update "-onclose %~dp0wub.exe /d /p"
Advertisement
Add Comment
Please, Sign In to add comment