Advertisement
Guest User

WUMT Wrapper Script 2.2.8

a guest
May 7th, 2018
564
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.70 KB | None | 0 0
  1. Script:
  2. @echo off & goto start
  3. WUMT Wrapper Script version 2.2.8
  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. *******************************************************************
  33. 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,
  34. 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,
  35. 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),
  36. 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
  37. written for Windows 10 Pro and Home, but works with all versions of Windows 10.
  38. *******************************************************************
  39. *If you need to install .Net 3.5 or use the Windows 10 Store or something that needs wuauserv
  40. running, run the script and after it enables wuauserv and starts WUMT, install what you need
  41. after WUMT checks for updates, before closing WUMT. If you ran the Configurator to "leave
  42. the Windows Update Service running at all times" you can ignore this note as the store will
  43. work at any time and Windows Defender will get updates.
  44. *******************************************************************
  45. :start
  46. :::::::::::::::::::::::::::::::::::::::::
  47. :: Automatically check & get admin rights
  48. :::::::::::::::::::::::::::::::::::::::::
  49. Title WUMT Wrapper Script 2.2.8
  50. Color 1F
  51. CLS
  52. :: ECHO.
  53. :: ECHO =============================
  54. :: ECHO Running Admin shell
  55. :: ECHO =============================
  56. :: Check Privileges
  57. :: Get Privileges
  58. :: and
  59. :: Invoke UAC for Privilege Escalation
  60. :: Notify if error escalating
  61. :: and prevent looping if escalation fails
  62. ::::::::::::::::::::::::::::
  63. set "params=Problem_with_elevating_UAC_for_Administrator_Privileges"&if exist "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs"
  64. fsutil dirty query %systemdrive% >nul 2>&1 && goto :GotPrivileges
  65. :: The following test is to avoid infinite looping if elevating UAC for Administrator Privileges failed
  66. 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)
  67. cmd /u /c echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "%~0", "%params%", "", "runas", 1 > "%temp%\getadmin.vbs"&cscript //nologo "%temp%\getadmin.vbs"&exit
  68. :GotPrivileges
  69. ::::::::::::::::::::::::::::
  70. ::START
  71. ::Uninstall and remove Windows 10 Update assistant.
  72. ::Disable Windows Update Service until script menu screen.
  73. ::Reset (in case of wrong Permissions), remove Permissions from and Disable UsoClient.exe,
  74. ::WaaSMedic.exe, WaasMedicSvc.dll, WaaSMedicPS.dll, WaaSAssessment.dll, and SIHClient.exe.
  75. ::Kill remsh.exe if it's running.
  76. ::Rename the folder %ProgramFiles%\rempl to %ProgramFiles%\rempl-backup if it exists.
  77. ::Install wub_task (prevents Windows Update service from starting after installing updates and rebooting).
  78. ::Enable and start the Windows Update Service (wuauserv).
  79. ::Run the correct version of WUMT for your architecture.
  80. ::Start WUMT in "auto-check for updates" mode.
  81. ::After updates are completed and WUMT is closed and/or the "reboot"
  82. ::button in WUMT is pressed, silently run wub.exe and disable and stop wuauserv
  83. ::::::::::::::::::::::::::::
  84. echo.
  85. echo Please wait...
  86. ::::::::::::::::::::::::::::
  87. @echo off
  88. cls
  89. if exist "%systemdrive%\Windows10Upgrade\Windows10UpgraderApp.exe" ( echo Windows 10 Update Assistant detected. Preparing to uninstall. ) else ( goto noevil )
  90. echo The "Windows 10 Update Assistant has stopped working" dialog box may pop up. If so, just close it.
  91. echo Press a key to acknowledge this and please wait 15 seconds for the uninstall to finish.
  92. echo Script will continue after uninstall and removal is completed...
  93. pause > nul
  94. echo Uninstalling Windows 10 Update Assistant...
  95. %systemdrive%\Windows10Upgrade\Windows10UpgraderApp.exe /forceuninstall
  96. timeout /t 15 /nobreak >nul 2>&1
  97. del %systemroot%\UpdateAssistant\*.* /f /q >nul 2>&1
  98. rmdir %systemroot%\UpdateAssistant /s /q >nul 2>&1
  99. del %SystemDrive%\Windows10Upgrade\*.* /f /q >nul 2>&1
  100. rmdir %SystemDrive%\Windows10Upgrade /s /q >nul 2>&1
  101. cls
  102. echo Windows 10 Update Assistant removed.
  103. echo Press a key to continue...
  104. pause > nul
  105. :noevil
  106. del %systemroot%\UpdateAssistantV2\*.* /f /q >nul 2>&1
  107. rmdir %systemroot%\UpdateAssistantV2 /s /q >nul 2>&1
  108. ::::::::::::::::::::::::::::
  109. "%~dp0wub.exe" /d /p >nul 2>&1
  110. ::::::::::::::::::::::::::::
  111. takeown /f "%systemroot%\System32\UsoClient.exe" /a >nul 2>&1
  112. icacls "%systemroot%\System32\UsoClient.exe" /reset >nul 2>&1
  113. 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
  114. ::::::::::::::::::::::::::::
  115. takeown /f "%systemroot%\System32\WaaSMedic.exe" /a >nul 2>&1
  116. icacls "%systemroot%\System32\WaaSMedic.exe" /reset >nul 2>&1
  117. 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
  118. ::::::::::::::::::::::::::::
  119. takeown /f "%systemroot%\System32\WaasMedicSvc.dll" /a >nul 2>&1
  120. icacls "%systemroot%\System32\WaasMedicSvc.dll" /reset >nul 2>&1
  121. 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
  122. ::::::::::::::::::::::::::::
  123. takeown /f "%systemroot%\System32\WaaSMedicPS.dll" /a >nul 2>&1
  124. icacls "%systemroot%\System32\WaaSMedicPS.dll" /reset >nul 2>&1
  125. 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
  126. ::::::::::::::::::::::::::::
  127. takeown /f "%systemroot%\System32\WaaSAssessment.dll" /a >nul 2>&1
  128. icacls "%systemroot%\System32\WaaSAssessment.dll" /reset >nul 2>&1
  129. 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
  130. ::::::::::::::::::::::::::::
  131. takeown /f "%systemroot%\System32\SIHClient.exe" /a >nul 2>&1
  132. icacls "%systemroot%\System32\SIHClient.exe" /reset >nul 2>&1
  133. 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
  134. ::::::::::::::::::::::::::::
  135. taskkill /im remsh.exe /f >nul 2>&1
  136. if exist "%ProgramFiles%\rempl" rmdir /s /q "%ProgramFiles%\rempl-backup" >nul 2>&1
  137. ren "%ProgramFiles%\rempl" rempl-backup >nul 2>&1
  138. ::::::::::::::::::::::::::::
  139. set "Task_Name=wub_task"
  140. schtasks /delete /tn "%Task_Name%" /f 1>nul 2>nul
  141. schtasks /query /tn "%Task_Name%" >nul 2>&1 || (
  142. echo.&echo Creating Windows Update Blocker Auto-Renewal task %Task_Name%.
  143. (echo ^<?xml version="1.0" encoding="UTF-16"?^>
  144. echo ^<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task"^>
  145. echo ^<RegistrationInfo^>
  146. echo ^<Date^>2018-02-18T08:29:39^</Date^>
  147. echo ^<Author^>pf100\rpo^</Author^>
  148. echo ^<URI^>\wub_task^</URI^>
  149. echo ^</RegistrationInfo^>
  150. echo ^<Triggers^>
  151. echo ^<BootTrigger^>
  152. echo ^<StartBoundary^>2018-02-18T08:29:00^</StartBoundary^>
  153. echo ^<Enabled^>true^</Enabled^>
  154. echo ^</BootTrigger^>
  155. echo ^</Triggers^>
  156. echo ^<Principals^>
  157. echo ^<Principal id="Author"^>
  158. echo ^<RunLevel^>HighestAvailable^</RunLevel^>
  159. echo ^</Principal^>
  160. echo ^</Principals^>
  161. echo ^<Settings^>
  162. echo ^<MultipleInstancesPolicy^>IgnoreNew^</MultipleInstancesPolicy^>
  163. echo ^<DisallowStartIfOnBatteries^>false^</DisallowStartIfOnBatteries^>
  164. echo ^<StopIfGoingOnBatteries^>false^</StopIfGoingOnBatteries^>
  165. echo ^<AllowHardTerminate^>true^</AllowHardTerminate^>
  166. echo ^<StartWhenAvailable^>false^</StartWhenAvailable^>
  167. echo ^<RunOnlyIfNetworkAvailable^>false^</RunOnlyIfNetworkAvailable^>
  168. echo ^<IdleSettings^>
  169. echo ^<StopOnIdleEnd^>true^</StopOnIdleEnd^>
  170. echo ^<RestartOnIdle^>false^</RestartOnIdle^>
  171. echo ^</IdleSettings^>
  172. echo ^<AllowStartOnDemand^>true^</AllowStartOnDemand^>
  173. echo ^<Enabled^>true^</Enabled^>
  174. echo ^<Hidden^>false^</Hidden^>
  175. echo ^<RunOnlyIfIdle^>false^</RunOnlyIfIdle^>
  176. echo ^<WakeToRun^>false^</WakeToRun^>
  177. echo ^<ExecutionTimeLimit^>PT72H^</ExecutionTimeLimit^>
  178. echo ^<Priority^>7^</Priority^>
  179. echo ^</Settings^>
  180. echo ^<Actions Context="Author"^>
  181. echo ^<Exec^>
  182. echo ^<Command^>"%~dp0wub.exe"^</Command^>
  183. echo ^<Arguments^>/d /p^</Arguments^>
  184. echo ^</Exec^>
  185. echo ^</Actions^>
  186. echo ^</Task^>) >"%~dp0%Task_Name%.xml"
  187. schtasks /create /tn "%Task_Name%" /ru "SYSTEM" /xml "%~dp0%Task_Name%.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"
  221.  
  222. --------------------------------------------------------------------------------------------------------------------------------------
  223. --------------------------------------------------------------------------------------------------------------------------------------
  224.  
  225. Configurator:
  226. @echo off
  227. Color 1F
  228. Title WUMT Wrapper Script Configurator 2.2.8
  229. ::::::::::::::::::::::::::::
  230. set "params=Problem_with_elevating_UAC_for_Administrator_Privileges"&if exist "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs"
  231. fsutil dirty query %systemdrive% >nul 2>&1 && goto :GotPrivileges
  232. :: The following test is to avoid infinite looping if elevating UAC for Administrator Privileges failed
  233. 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)
  234. cmd /u /c echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "%~0", "%params%", "", "runas", 1 > "%temp%\getadmin.vbs"&cscript //nologo "%temp%\getadmin.vbs"&exit
  235. :GotPrivileges
  236. ::::::::::::::::::::::::::::
  237. echo Welcome to WUMT Wrapper Script Configurator
  238. echo [D]isable Update Service and only allow to run during manual updates (default)
  239. echo.
  240. echo [K]eep the Update Service always running to allow Defender Updates and Store at any time
  241. echo.
  242. CHOICE /C DK /M "YOUR CHOICE ?:"
  243. if %errorlevel%==2 goto enablewub
  244. if %errorlevel%==1 goto disablewub
  245. :enablewub
  246. "%~dp0wub.exe" /e >nul 2>&1
  247. ren "%~dp0wub.exe" wub.exe-backup >nul 2>&1
  248. cls
  249. echo Windows Update Service now enabled and running and it won't be manipulated by wrapper script.
  250. echo To reverse changes just run script again.
  251. echo Press any key to exit...
  252. pause > nul
  253. goto end
  254. :disablewub
  255. ren "%~dp0wub.exe-backup" wub.exe >nul 2>&1
  256. "%~dp0wub.exe" /d /p >nul 2>&1
  257. cls
  258. echo Windows Update Service disabled except for manual update checks with script.
  259. echo To reverse changes just run script again.
  260. echo Press any key to exit...
  261. pause > nul
  262. :end
  263.  
  264. -------------------------------------------------------------------------------------------------------------------------------------
  265. -------------------------------------------------------------------------------------------------------------------------------------
  266.  
  267. Uninstaller:
  268. @echo off
  269. Color 1F
  270. Title WUMT Wrapper Script 2.2.8 uninstaller
  271. set "params=Problem_with_elevating_UAC_for_Administrator_Privileges"&if exist "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs"
  272. fsutil dirty query %systemdrive% >nul 2>&1 && goto :GotPrivileges
  273. :: The following test is to avoid infinite looping if elevating UAC for Administrator Privileges failed
  274. 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)
  275. cmd /u /c echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "%~0", "%params%", "", "runas", 1 > "%temp%\getadmin.vbs"&cscript //nologo "%temp%\getadmin.vbs"&exit
  276. :GotPrivileges
  277. echo Press a key to uninstall WUMT Wrapper Script
  278. echo or close window or ctrl-c to cancel.
  279. pause > nul
  280. @echo on
  281. ren "%ProgramFiles%\rempl-backup" rempl
  282. ren "%~dp0wub.exe-backup" wub.exe
  283. schtasks /delete /tn "wub_task" /f
  284. ::::::::::::::::::::::::::::::::::
  285. takeown /f "%systemroot%\System32\UsoClient.exe" /a
  286. icacls "%systemroot%\System32\UsoClient.exe" /reset
  287. icacls "%systemroot%\System32\UsoClient.exe" /setowner *S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464
  288. ::::::::::::::::::::::::::::::::::
  289. takeown /f "%systemroot%\System32\WaaSMedic.exe" /a
  290. icacls "%systemroot%\System32\WaaSMedic.exe" /reset
  291. icacls "%systemroot%\System32\WaaSMedic.exe" /setowner *S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464
  292. ::::::::::::::::::::::::::::::::::
  293. takeown /f "%systemroot%\System32\WaasMedicSvc.dll" /a
  294. icacls "%systemroot%\System32\WaasMedicSvc.dll" /reset
  295. icacls "%systemroot%\System32\WaasMedicSvc.dll" /setowner *S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464
  296. ::::::::::::::::::::::::::::::::::
  297. takeown /f "%systemroot%\System32\WaaSMedicPS.dll" /a
  298. icacls "%systemroot%\System32\WaaSMedicPS.dll" /reset
  299. icacls "%systemroot%\System32\WaaSMedicPS.dll" /setowner *S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464
  300. ::::::::::::::::::::::::::::::::::
  301. takeown /f "%systemroot%\System32\WaaSAssessment.dll" /a
  302. icacls "%systemroot%\System32\WaaSAssessment.dll" /reset
  303. icacls "%systemroot%\System32\WaaSAssessment.dll" /setowner *S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464
  304. ::::::::::::::::::::::::::::::::::
  305. takeown /f "%systemroot%\System32\SIHClient.exe" /a
  306. icacls "%systemroot%\System32\SIHClient.exe" /reset
  307. icacls "%systemroot%\System32\SIHClient.exe" /setowner *S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464
  308. ::::::::::::::::::::::::::::::::::
  309. "%~dp0wub.exe" /e
  310. @echo off
  311. echo ::::::::::::::::::::::::::::::::::::
  312. echo :WUMT Wrapper Script changes undone:
  313. echo ::::::::::::::::::::::::::::::::::::
  314. echo Press any key to exit...
  315. pause > nul
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement