pf100

WUMT Wrapper Script 2.2.9

May 9th, 2018
740
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.72 KB | None | 0 0
  1. @echo off
  2. Title WUMT Wrapper Script 2.2.9
  3. Color 1F & goto start
  4. Original script by pf100 @ MDL with special thanks to rpo and abbodi1406 @ MDL for code improvements.
  5. https://forums.mydigitallife.net/threads/72203-WUMT-Wrapper-script-controls-windows-update-service
  6. ******************************************************************
  7. You may freely modify this script as you wish, I only request that you leave the credits and the
  8. link to the original script.
  9. ******************************************************************
  10. This script provides manual updates.
  11. Update Windows 10 on your schedule, not Microsoft's!
  12. I originally wrote this script for personal use because of the lack of update options with the
  13. original RTM release of Windows 10 Pro. I wanted to update Windows 10 when I had the free time
  14. to manually update, just like I did with previous versions of Windows that allowed me to
  15. set updates to manual, not when Microsoft forced it on me while I was busy using my computer.
  16. When my computer rebooted in the middle of the night after a forced update I swore it would be
  17. the last time I would let that happen. With the Windows 10 Anniversary Edition, increased lack
  18. of control and arbitrary removal of registry options only got worse. Microsoft removed previously
  19. working Group Policies and registry tweaks on Windows 10 Pro and Windows 10 Home and I expect
  20. things may only get worse with future major updates. The methods that may or may not work now
  21. such as update notifications, metered network connections, Windows 10 Pro Group Policy edits,
  22. and other workarounds implemented to control automatic updates are not guaranteed to work forever
  23. on Windows 10 if the past is any indicator. This script will always allow fully
  24. manual updates no matter what Microsoft does to force automatic updates, including Windows 10 Home.
  25. *******************************************************************
  26. Installation: Save this script, the Windows Update MiniTool (WUMT), and Windows Update Blocker in the same folder, i.e.
  27. "X:\Windows Update", then make a shortcut to this script and use it to run windows updates
  28. manually from now on. You only have to make the shortcut run as administrator if you have an elevation problem since it auto-elevates.
  29. WUMT is available here: https://forums.mydigitallife.net/threads/64939-Windows-Update-MiniTool
  30. *It is recommended to keep the Windows Update Minitool (WUMT) updated to the latest version.*
  31. Windows Update Blocker is available here: http://www.sordum.org/9470/windows-update-blocker-v1-0/
  32. Only use Windows Update Blocker v1.0 with this script.
  33. *******************************************************************
  34. How it works: This script auto-elevates, uninstalls and removes the Windows 10 Update Assistant, renames the rempl folder (disabling remsh.exe), resets and removes permissions from and disables UsoClient.exe, WaaSMedic.exe, WaasMedicSvc.dll, WaaSMedicPS.dll, WaaSAssessment.dll and SIHClient.exe,
  35. makes sure the task "wub_task" is installed (keeps updates off after reboot), runs wub and enables and starts the windows update service (wuauserv) if disabled,
  36. then runs the correct version of the Windows Update MiniTool in "auto search for updates" mode for your OS version's architecture (x86 or x64),
  37. then disables and stops wuauserv giving you full control. No more forced automatic updates or surprise reboots in the middle of the night. This was
  38. written for Windows 10 Pro and Home, but works with all versions of Windows 10.
  39. *******************************************************************
  40. *If you need to install .Net 3.5 or use the Windows 10 Store or something that needs wuauserv
  41. running, run the script and after it enables wuauserv and starts WUMT, install what you need
  42. after WUMT checks for updates, before closing WUMT. If you ran the Configurator to "leave
  43. the Windows Update Service running at all times" you can ignore this note as the store will
  44. work at any time and Windows Defender will get updates.
  45. *******************************************************************
  46. :start
  47. :::::::::::::::::::::::::::::::::::::::::
  48. :: Automatically check & get admin rights
  49. :::::::::::::::::::::::::::::::::::::::::
  50. :: ECHO.
  51. :: ECHO =============================
  52. :: ECHO Running Admin shell
  53. :: ECHO =============================
  54. :: Check Privileges
  55. :: Get Privileges
  56. :: and
  57. :: Invoke UAC for Privilege Escalation
  58. :: Notify if error escalating
  59. :: and prevent looping if escalation fails
  60. ::::::::::::::::::::::::::::
  61. set "params=Problem_with_elevating_UAC_for_Administrator_Privileges"&if exist "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs"
  62. fsutil dirty query %systemdrive% >nul 2>&1 && goto :GotPrivileges
  63. :: The following test is to avoid infinite looping if elevating UAC for Administrator Privileges failed
  64. 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)
  65. cmd /u /c echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "%~0", "%params%", "", "runas", 1 > "%temp%\getadmin.vbs"&cscript //nologo "%temp%\getadmin.vbs"&exit
  66. :GotPrivileges
  67. ::::::::::::::::::::::::::::
  68. ::START
  69. ::Uninstall and remove Windows 10 Update assistant.
  70. ::Disable Windows Update Service until script menu screen.
  71. ::Reset (in case of wrong Permissions), remove Permissions from and Disable UsoClient.exe,
  72. ::WaaSMedic.exe, WaasMedicSvc.dll, WaaSMedicPS.dll, WaaSAssessment.dll, and SIHClient.exe.
  73. ::Kill remsh.exe if it's running.
  74. ::Rename the folder %ProgramFiles%\rempl to %ProgramFiles%\rempl-backup if it exists.
  75. ::Install wub_task (prevents Windows Update service from starting after installing updates and rebooting).
  76. ::Enable and start the Windows Update Service (wuauserv).
  77. ::Run the correct version of WUMT for your architecture.
  78. ::Start WUMT in "auto-check for updates" mode.
  79. ::After updates are completed and WUMT is closed and/or the "reboot"
  80. ::button in WUMT is pressed, silently run wub.exe and disable and stop wuauserv
  81. ::::::::::::::::::::::::::::
  82. @echo off
  83. cls
  84. if exist "%systemdrive%\Windows10Upgrade\Windows10UpgraderApp.exe" ( echo Windows 10 Update Assistant detected. Preparing to uninstall. ) else ( goto noevil )
  85. echo The "Windows 10 Update Assistant has stopped working" dialog box may pop up. If so, just close it.
  86. echo Press a key to acknowledge this and please wait 15 seconds for the uninstall to finish.
  87. echo Script will continue after uninstall and removal is completed...
  88. pause > nul
  89. echo Uninstalling Windows 10 Update Assistant...
  90. %systemdrive%\Windows10Upgrade\Windows10UpgraderApp.exe /forceuninstall
  91. timeout /t 15 /nobreak >nul 2>&1
  92. del %systemroot%\UpdateAssistant\*.* /f /q >nul 2>&1
  93. rmdir %systemroot%\UpdateAssistant /s /q >nul 2>&1
  94. del %SystemDrive%\Windows10Upgrade\*.* /f /q >nul 2>&1
  95. rmdir %SystemDrive%\Windows10Upgrade /s /q >nul 2>&1
  96. cls
  97. echo Windows 10 Update Assistant removed.
  98. echo Press a key to continue...
  99. pause > nul
  100. :noevil
  101. cls
  102. ::::::::::::::::::::::::::::
  103. echo.
  104. echo Please wait...
  105. ::::::::::::::::::::::::::::
  106. del %systemroot%\UpdateAssistantV2\*.* /f /q >nul 2>&1
  107. rmdir %systemroot%\UpdateAssistantV2 /s /q >nul 2>&1
  108. "%~dp0wub.exe" /d /p >nul 2>&1
  109. ::::::::::::::::::::::::::::
  110. takeown /f "%systemroot%\System32\UsoClient.exe" /a >nul 2>&1
  111. icacls "%systemroot%\System32\UsoClient.exe" /reset >nul 2>&1
  112. 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
  113. ::::::::::::::::::::::::::::
  114. takeown /f "%systemroot%\System32\WaaSMedic.exe" /a >nul 2>&1
  115. icacls "%systemroot%\System32\WaaSMedic.exe" /reset >nul 2>&1
  116. 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
  117. ::::::::::::::::::::::::::::
  118. takeown /f "%systemroot%\System32\WaasMedicSvc.dll" /a >nul 2>&1
  119. icacls "%systemroot%\System32\WaasMedicSvc.dll" /reset >nul 2>&1
  120. 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
  121. ::::::::::::::::::::::::::::
  122. takeown /f "%systemroot%\System32\WaaSMedicPS.dll" /a >nul 2>&1
  123. icacls "%systemroot%\System32\WaaSMedicPS.dll" /reset >nul 2>&1
  124. 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
  125. ::::::::::::::::::::::::::::
  126. takeown /f "%systemroot%\System32\WaaSAssessment.dll" /a >nul 2>&1
  127. icacls "%systemroot%\System32\WaaSAssessment.dll" /reset >nul 2>&1
  128. 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
  129. ::::::::::::::::::::::::::::
  130. takeown /f "%systemroot%\System32\SIHClient.exe" /a >nul 2>&1
  131. icacls "%systemroot%\System32\SIHClient.exe" /reset >nul 2>&1
  132. 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
  133. ::::::::::::::::::::::::::::
  134. taskkill /im remsh.exe /f >nul 2>&1
  135. if exist "%ProgramFiles%\rempl" rmdir /s /q "%ProgramFiles%\rempl-backup" >nul 2>&1
  136. ren "%ProgramFiles%\rempl" rempl-backup >nul 2>&1
  137. ::::::::::::::::::::::::::::
  138. set "Task_Name=wub_task"
  139. schtasks /delete /tn "%Task_Name%" /f 1>nul 2>nul
  140. schtasks /query /tn "%Task_Name%" >nul 2>&1 || (
  141. echo.&echo Creating Windows Update Blocker Auto-Renewal task %Task_Name%.
  142. (echo ^<?xml version="1.0" encoding="UTF-16"?^>
  143. echo ^<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task"^>
  144. echo ^<RegistrationInfo^>
  145. echo ^<Date^>2018-02-18T08:29:39^</Date^>
  146. echo ^<Author^>pf100\rpo^</Author^>
  147. echo ^<URI^>\wub_task^</URI^>
  148. echo ^</RegistrationInfo^>
  149. echo ^<Triggers^>
  150. echo ^<BootTrigger^>
  151. echo ^<StartBoundary^>2018-02-18T08:29:00^</StartBoundary^>
  152. echo ^<Enabled^>true^</Enabled^>
  153. echo ^</BootTrigger^>
  154. echo ^</Triggers^>
  155. echo ^<Principals^>
  156. echo ^<Principal id="Author"^>
  157. echo ^<RunLevel^>HighestAvailable^</RunLevel^>
  158. echo ^</Principal^>
  159. echo ^</Principals^>
  160. echo ^<Settings^>
  161. echo ^<MultipleInstancesPolicy^>IgnoreNew^</MultipleInstancesPolicy^>
  162. echo ^<DisallowStartIfOnBatteries^>false^</DisallowStartIfOnBatteries^>
  163. echo ^<StopIfGoingOnBatteries^>false^</StopIfGoingOnBatteries^>
  164. echo ^<AllowHardTerminate^>true^</AllowHardTerminate^>
  165. echo ^<StartWhenAvailable^>false^</StartWhenAvailable^>
  166. echo ^<RunOnlyIfNetworkAvailable^>false^</RunOnlyIfNetworkAvailable^>
  167. echo ^<IdleSettings^>
  168. echo ^<StopOnIdleEnd^>true^</StopOnIdleEnd^>
  169. echo ^<RestartOnIdle^>false^</RestartOnIdle^>
  170. echo ^</IdleSettings^>
  171. echo ^<AllowStartOnDemand^>true^</AllowStartOnDemand^>
  172. echo ^<Enabled^>true^</Enabled^>
  173. echo ^<Hidden^>false^</Hidden^>
  174. echo ^<RunOnlyIfIdle^>false^</RunOnlyIfIdle^>
  175. echo ^<WakeToRun^>false^</WakeToRun^>
  176. echo ^<ExecutionTimeLimit^>PT72H^</ExecutionTimeLimit^>
  177. echo ^<Priority^>7^</Priority^>
  178. echo ^</Settings^>
  179. echo ^<Actions Context="Author"^>
  180. echo ^<Exec^>
  181. echo ^<Command^>"%~dp0wub.exe"^</Command^>
  182. echo ^<Arguments^>/d /p^</Arguments^>
  183. echo ^</Exec^>
  184. echo ^</Actions^>
  185. echo ^</Task^>) >"%~dp0%Task_Name%.xml"
  186. schtasks /create /tn "%Task_Name%" /ru "SYSTEM" /xml "%~dp0%Task_Name%.xml" >nul 2>&1)
  187. del /f /q "%~dp0%wub_task.xml" >nul 2>&1)
  188. ::::::::::::::::::::::::::::
  189. cls
  190. echo ***********************************************
  191. echo Welcome to manual updates!
  192. echo Automatic updates are now turned off
  193. echo (unless overriden with Configurator).
  194. echo This script automates the update process
  195. echo It automatically disables a range of useless junk
  196. echo that bypasses windows update, such as:
  197. echo remsh, UsoClient, WaaSMedic, SIHClient, and Update Assistant.*
  198. echo Enables and starts only the Windows Update Service.
  199. echo Runs the Windows Update MiniTool (WUMT).
  200. echo After updates, stops and disables the Windows Update service.
  201. echo *The included uninstaller undoes script changes.*
  202. echo Closing WUMT at any time disables updates again;
  203. echo however, if WUMT is already offering updates, you
  204. echo need to hide them and/or install them one-by-one
  205. echo before closing WUMT or it may install them without
  206. echo asking next time. Don't change WUMT settings while
  207. echo running this script. If an update requires a reboot,
  208. echo re-run the script and just close the first screen
  209. echo to make sure the useless junk that forces updates
  210. echo stay off.
  211. echo Run Configurator.cmd to enable running store and defender
  212. echo ***********************************************
  213. echo. & echo Press any key to check for updates, or
  214. echo close this screen to cancel and leave updates turned off
  215. echo (unless overridden with configurator) & pause > nul
  216. "%~dp0wub.exe" /e
  217. :: Check OS and run correct version of WUMT
  218. for /f "tokens=2 delims==" %%a in ('wmic cpu get AddressWidth /value') do (set arch=%%a)
  219. IF %arch% == 32 (set "wumt=%~dp0wumt_x86.exe") else (set "wumt=%~dp0wumt_x64.exe")
  220. Start "" "%wumt%" -update "-onclose %~dp0wub.exe /d /p"
Advertisement
Add Comment
Please, Sign In to add comment