pf100

v2.6.1rc4-Sledgehammer.cmd

May 10th, 2019
546
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 34.04 KB | None | 0 0
  1. @echo off
  2. mode con cols=89 lines=34
  3. Title Sledgehammer 2.6.1 rc4
  4. Color 1F & goto start
  5. Original script by pf100 @ MDL with special thanks to rpo and abbodi1406 @ MDL for code improvements.
  6. Thanks to RetiredGeek at askwoody.com forum for original ideas on how to get MS-DEFCON rating.
  7. Project page and source code:
  8. https://forums.mydigitallife.net/threads/sledgehammer-windows-10-update-control.72203/
  9. ******************************************************************
  10. You may freely modify this script as you wish, I only request that you leave the credits and the
  11. link to the original script.
  12. ******************************************************************
  13. Don't move this script to another folder without running it again or the tasks won't work!
  14. This script provides manual updating for Windows 10 including Home versions.
  15. Update Windows 10 on your schedule, not Microsoft's!
  16. I originally wrote this script for personal use because of the lack of update options with the
  17. original RTM release of Windows 10 Pro. I wanted to update Windows 10 when I had the free time
  18. to manually update, just like I did with previous versions of Windows that allowed me to
  19. set updates to manual, not when Microsoft forced it on me while I was busy using my computer.
  20. *******************************************************************
  21. WUMT is available here: https://forums.mydigitallife.net/threads/64939-Windows-Update-MiniTool
  22. Windows Update Blocker is available here: http://sordum.org/files/windows-update-blocker/old/Wub_v1.0.zip
  23. Only use Windows Update Blocker v1.0 with this script, NOT v1.1!
  24. NSudo is available here: https://github.com/M2Team/NSudo/releases/tag/6.1
  25. *******************************************************************
  26. How it works: The script first checks if the OS is Windows 8.1 or older and if so
  27. it notifies the user, then exits. Windows 10 only!
  28. This script creates a smart Windows Defender Update task "WDU" that updates Windows
  29. Defender every 6 hours if it's running and enabled, and doesn't update it if it's not
  30. running and disabled, saving resources; auto-elevates, uninstalls and removes the
  31. Windows 10 Update Assistant, disables everything in the %programfiles%\rempl folder, resets and
  32. removes permissions from and disables these Update Hijackers:
  33. EOSNotify.exe
  34. WaaSMedic.exe
  35. WaasMedicSvc.dll
  36. WaaSMedicPS.dll
  37. WaaSAssessment.dll
  38. UsoClient.exe
  39. SIHClient.exe
  40. MusNotificationUx.exe
  41. MusNotification.exe
  42. osrss.dll
  43. %ProgramFiles%\rempl
  44. %systemroot%\UpdateAssistant
  45. %systemroot%\UpdateAssistantV2
  46. %systemdrive%\Windows10Upgrade
  47. disables all WindowsUpdate tasks
  48. makes sure the task "wub_task" is installed that runs wub at boot (to stop updates from turning
  49. updates back on), runs wub.exe and enables and starts the windows update service (wuauserv) if
  50. disabled, installs "WDU" Windows Defender Update task that runs every 2 hours (but doesn't update
  51. Defender if Defender is disabled), then runs the correct version of the Windows Update MiniTool in
  52. "auto search for updates" mode for your OS version's architecture (x86 or x64), then disables and
  53. stops wuauserv giving you full control. No more forced automatic updates or surprise reboots.
  54. This was written for Windows 10 Pro and Home, but works with all versions of Windows 10. Don't
  55. change any settings in lower left of WUMT while running the script.
  56. *******************************************************************
  57. I also included an uninstaller.cmd that deletes the "WDU" and "wub_task" tasks, deletes the WDU.cmd
  58. file used by WDU task, restores the rempl folder, resets Update Hijacker permissions to how they
  59. were originally, renables "WindowsUpdate" tasks, and turns off wub (if enabled) which turns the windows update service on automatic
  60. again, undoing everything done by the script. If you uninstall after having used the installer the
  61. script files are removed also.
  62. *******************************************************************
  63. Configurator leaves the Update Hijackers disabled, but gives you the option of turning on the windows
  64. update service temporarily to use the Store or any other operation that requires the windows update
  65. service, such as some DISM operations, installing dotNet 3.5, App Updates, etc.
  66. *******************************************************************
  67. :start
  68. ::::::::::::::::::::::::::::
  69. : ===========================================================
  70. : Check if the file path name contains special characters
  71. : https://stackoverflow.com/a/33626625
  72. : Written by @jeb (stackoverflow)
  73. : Thanks to @abbodi1406 (MDL) for the help.
  74. : ===========================================================
  75. setlocal
  76. setlocal DisableDelayedExpansion
  77. set "param=%~f0"
  78. cmd /v:on /c echo(^^!param^^!| findstr /R "[| ` ~ ! @ %% \^ & ( ) \[ \] { } + = ; ' , |]*^"
  79. endlocal
  80. if %errorlevel% EQU 0 (
  81. cls
  82. echo.
  83. echo ==== Sledgehammer folder name Error ====
  84. echo.
  85. echo File path has disallowed special characters. Such as:
  86. echo.
  87. echo "[| ` ~ ! @ %% \^ & ( ) \[ \] { } + = ; ' , |]*^"
  88. echo.
  89. echo Put Sledgehammer script in folder without special characters.
  90. echo.
  91. echo Press any key to exit...
  92. pause >nul
  93. exit /b
  94. )
  95. ::::::::::::::::::::::::::::
  96. cd /d "%~dp0"
  97. :::::::::::::::::::::::::::::::::::::::::
  98. :: Automatically check & get admin rights
  99. :::::::::::::::::::::::::::::::::::::::::
  100. :: ECHO.
  101. :: ECHO =============================
  102. :: ECHO Running Admin shell
  103. :: ECHO =============================
  104. :: Check Privileges
  105. :: Get Privileges
  106. :: and
  107. :: Invoke UAC for Privilege Escalation
  108. :: Notify if error escalating
  109. :: and prevent looping if escalation fails
  110. ::::::::::::::::::::::::::::
  111. set "params=Problem_with_elevating_UAC_for_Administrator_Privileges"&if exist "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs"
  112. fsutil dirty query %systemdrive% >nul 2>&1 && goto :GotPrivileges
  113. :: The following test is to avoid infinite looping if elevating UAC for Administrator Privileges failed
  114. 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)
  115. cmd /u /c echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "%~0", "%params%", "", "runas", 1 > "%temp%\getadmin.vbs"&cscript //nologo "%temp%\getadmin.vbs" && exit /b || (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)
  116. :GotPrivileges
  117. ::::::::::::::::::::::::::::
  118. ::Uninstall and remove Windows 10 Update assistant.
  119. ::Disable Windows Update Service until script menu screen.
  120. ::Reset (in case of wrong Permissions), remove Permissions from and
  121. ::disable "Update Hijackers"
  122. ::Install wub_task (prevents Windows Update service from starting after installing updates and rebooting).
  123. ::Install "WDU" task that only updates Defender if it's enabled. Otherwise it doesn't do anything.
  124. ::Enable and start the Windows Update Service (wuauserv).
  125. ::Run the correct version of WUMT for your architecture.
  126. ::Start WUMT in "auto-check for updates" mode.
  127. ::After updates are completed and WUMT is closed and/or the "reboot"
  128. ::button in WUMT is pressed, silently run wub.exe and disable and stop wuauserv
  129. ::::::::::::::::::::::::::::
  130. ::Test for Windows versions below Windows 10 and if so inform user, then exit...
  131. ::Get Windows OS build number
  132. for /f "tokens=2 delims==" %%a in ('wmic path Win32_OperatingSystem get BuildNumber /value') do (
  133. set /a WinBuild=%%a
  134. )
  135. if %winbuild% LEQ 9600 (
  136. echo.&echo This is not Windows 10. Press a key to exit...
  137. pause > nul
  138. exit
  139. )
  140. ::::::::::::::::::::::::::::
  141. ::Determine if running 32 or 64 bit Windows OS and set variables accordingly.
  142. wmic cpu get AddressWidth /value|find "32">nul&&set PROCESSOR_ARCHITECTURE=X86||set PROCESSOR_ARCHITECTURE=AMD64
  143. if %PROCESSOR_ARCHITECTURE%==AMD64 (
  144. set "nsudovar=.\bin\NSudoCx64.exe"
  145. set "wumt=.\bin\wumt_x64.exe"
  146. ) else (
  147. set "nsudovar=.\bin\NSudoc.exe"
  148. set "wumt=.\bin\wumt_x86.exe"
  149. )
  150. ::::::::::::::::::::::::::::
  151. ::Remove and/or lock Update Assistant
  152. if exist "%systemdrive%\Windows10Upgrade\Windows10UpgraderApp.exe" ( echo Windows 10 Update Assistant detected. Preparing to uninstall.
  153. echo The "Windows 10 Update Assistant has stopped working" dialog box may pop up.
  154. echo If so, just close it.
  155. echo.& echo Press a key to acknowledge this and please wait for the uninstall to finish.
  156. echo Script will continue after uninstall and removal is completed...
  157. pause > nul
  158. echo Uninstalling Windows 10 Update Assistant...
  159. %systemdrive%\Windows10Upgrade\Windows10UpgraderApp.exe /forceuninstall
  160. timeout /t 10 /nobreak
  161. cls)
  162. ::::::::::::::::::::::::::::
  163. :: Get MS-Defcon from askwoody.com
  164. (
  165. echo # Get MS-Defcon from askwoody.com
  166. echo $progressPreference = 'silentlyContinue'
  167. echo "`r`nSledgehammer is attempting to retrieve MS-DEFCON rating from askwoody.com...`r`n"
  168. echo Try {$WebResponse = Invoke-WebRequest "https://www.askwoody.com/" -UseBasicParsing -TimeoutSec 10} Catch {$WebResponse=""}
  169. echo clear-host
  170. echo if ^($WebResponse.Statuscode -ne 200^){write-host "";"Unable to retrieve MS-DEFCON rating from askwoody.com"; exit}
  171. echo ForEach ^($Image in $WebResponse.Images^) {
  172. echo $x = $Image.OuterHTML.ToString^(^)
  173. echo If ^($x -like "*MS-DEFCON-*"^) {
  174. echo "`r`n MS-DEFCON = " + $x.split^('/'^)[8].split^('.'^)[0].SubString^(10,1^)
  175. echo "`r`n:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
  176. echo "`r`nMS-DEFCON 1: Current Microsoft patches are causing havoc. Don't patch.`r`n" + `
  177. echo "`r`nMS-DEFCON 2: Patch reliability is unclear. Unless you have an immediate, pressing need" + `
  178. echo "`r`n to install a specific patch, don't do it.`r`n" + `
  179. echo "`r`nMS-DEFCON 3: Patch reliability is unclear, but widespread attacks make patching prudent." + `
  180. echo "`r`n Go ahead and patch, but watch out for potential problems.`r`n" + `
  181. echo "`r`nMS-DEFCON 4: There are isolated problems with current patches, but they are well-known" + `
  182. echo "`r`n and documented here. Check this site to see if you're affected and if" + `
  183. echo "`r`n things look OK, go ahead and patch.`r`n" + `
  184. echo "`r`nMS-DEFCON 5: All's clear. Patch while it's safe.`r`n" + `
  185. echo "`r`n:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::`r`n" + `
  186. echo "`r`nMore info at https://www.askwoody.com`r`n" + `
  187. echo "`r`n:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
  188. echo exit
  189. echo }
  190. echo }
  191. )>"%temp%\awmsdc.ps1"
  192. PowerShell.exe -Nologo -NoProfile -ExecutionPolicy Bypass -command "%temp%\awmsdc.ps1"
  193. del "%temp%\awmsdc.ps1"
  194. ::::::::::::::::::::::::::::
  195. rem echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.
  196. echo. & echo Disabling update hijackers...
  197. echo Creating tasks...
  198. echo Disabling windows Update Service...
  199. echo. & echo :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  200. ::::::::::::::::::::::::::::
  201. ::Disable update service.
  202. call :wuauserv d
  203. ::::::::::::::::::::::::::::
  204. schtasks /delete /tn WDU >nul /f 2>&1
  205. schtasks /delete /tn Wub_task /f >nul 2>&1
  206. schtasks /Delete /Tn \Microsoft\WuWrapperScript\WDU /f >nul 2>&1
  207. schtasks /Delete /Tn \Microsoft\WuWrapperScript\Wub_task /f >nul 2>&1
  208. rmdir %SystemDrive%\Windows\System32\Tasks\Microsoft\WuWrapperScript /s /q >nul 2>&1
  209. %nsudovar% -ShowWindowMode:Hide -Wait -U:T -P:E reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\WuWrapperScript" /f >nul 2>&1
  210. schtasks /Delete /Tn \Microsoft\Sledgehammer\WDU /f >nul 2>&1
  211. schtasks /Delete /Tn \Microsoft\Sledgehammer\Wub_task /f >nul 2>&1
  212. rmdir %SystemDrive%\Windows\System32\Tasks\Microsoft\Sledgehammer /s /q >nul 2>&1
  213. %nsudovar% -ShowWindowMode:Hide -Wait -U:T -P:E reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Sledgehammer" /f >nul 2>&1
  214. ::::::::::::::::::::::::::::::::::
  215. takeown /f "%systemroot%\UpdateAssistant" /a >nul 2>&1
  216. icacls "%systemroot%\UpdateAssistant" /reset >nul 2>&1
  217. del %systemroot%\UpdateAssistant\*.* /f /q >nul 2>&1
  218. rmdir %systemroot%\UpdateAssistant /s /q >nul 2>&1
  219. md "%systemroot%\UpdateAssistant" >nul 2>&1
  220. attrib +s +h "%systemroot%\UpdateAssistant" >nul 2>&1
  221. %nsudovar% -ShowWindowMode:Hide -Wait -U:T -P:E "%systemroot%\System32\icacls.exe" %systemroot%\UpdateAssistant /inheritance:r /remove:g *S-1-5-32-544 *S-1-5-11 *S-1-5-32-545 *S-1-5-18 >nul 2>&1
  222. takeown /f "%systemroot%\UpdateAssistantV2" /a >nul 2>&1
  223. icacls "%systemroot%\UpdateAssistantV2" /reset >nul 2>&1
  224. del %systemroot%\UpdateAssistantV2\*.* /f /q >nul 2>&1
  225. md "%systemroot%\UpdateAssistantV2" >nul 2>&1
  226. attrib +s +h "%systemroot%\UpdateAssistantV2" >nul 2>&1
  227. %nsudovar% -ShowWindowMode:Hide -Wait -U:T -P:E "%systemroot%\System32\icacls.exe" %systemroot%\UpdateAssistantV2 /inheritance:r /remove:g *S-1-5-32-544 *S-1-5-11 *S-1-5-32-545 *S-1-5-18 >nul 2>&1
  228. takeown /f "%SystemDrive%\Windows10Upgrade" /a >nul 2>&1
  229. icacls "%SystemDrive%\Windows10Upgrade" /reset >nul 2>&1
  230. del %SystemDrive%\Windows10Upgrade\*.* /f /q >nul 2>&1
  231. rmdir %SystemDrive%\Windows10Upgrade /s /q >nul 2>&1
  232. md "%systemdrive%\Windows10Upgrade" >nul 2>&1
  233. attrib +s +h %systemdrive%\Windows10Upgrade >nul 2>&1
  234. %nsudovar% -ShowWindowMode:Hide -Wait -U:T -P:E "%systemroot%\System32\icacls.exe" %systemdrive%\Windows10Upgrade /inheritance:r /remove:g *S-1-5-32-544 *S-1-5-11 *S-1-5-32-545 *S-1-5-18 >nul 2>&1
  235. ::::::::::::::::::::::::::::
  236. ::Disable rempl
  237. if not exist "%ProgramFiles%\rempl" goto norempl
  238. takeown /f "%ProgramFiles%\rempl" /a >nul 2>&1
  239. icacls "%ProgramFiles%\rempl" /reset >nul 2>&1
  240. for %%? in ("%ProgramFiles%\rempl\*") do (
  241. takeown /f "%%?" /a >nul 2>&1
  242. icacls "%%?" /reset >nul 2>&1
  243. )
  244. del %ProgramFiles%\rempl\*.* /f /q >nul 2>&1
  245. rmdir %ProgramFiles%\rempl /s /q >nul 2>&1
  246. :norempl
  247. ::The rempl folder doesn't exist, so create it and lock it from system access.
  248. md "%ProgramFiles%\rempl" >nul 2>&1
  249. attrib +s +h "%ProgramFiles%\rempl" >nul 2>&1
  250. %nsudovar% -ShowWindowMode:Hide -Wait -U:T -P:E "%systemroot%\System32\icacls.exe" "%ProgramFiles%\rempl" /inheritance:r /remove:g *S-1-5-32-544 *S-1-5-11 *S-1-5-32-545 *S-1-5-18 >nul 2>&1
  251. ::::::::::::::::::::::::::::
  252. :: Disable all Language Components Installer tasks
  253. takeown /f "%systemroot%\System32\Tasks\Microsoft\Windows\LanguageComponentsInstaller\*" /a >nul 2>&1
  254. icacls "%systemroot%\System32\Tasks\Microsoft\Windows\LanguageComponentsInstaller\*" /q /c /t /reset >nul 2>&1
  255. for %%? in ("%systemroot%\System32\Tasks\Microsoft\Windows\LanguageComponentsInstaller\*") do schtasks /change /tn "Microsoft\Windows\LanguageComponentsInstaller\%%~nx?" /disable >nul 2>&1
  256. ::::::::::::::::::::::::::::
  257. :: Disable and lock all Windows Update tasks.
  258. takeown /f "%systemroot%\System32\Tasks\Microsoft\Windows\WindowsUpdate\*" /a >nul 2>&1
  259. icacls "%systemroot%\System32\Tasks\Microsoft\Windows\WindowsUpdate\*" /q /c /t /reset >nul 2>&1
  260. for %%? in ("%systemroot%\System32\Tasks\Microsoft\Windows\WindowsUpdate\*") do schtasks /change /tn "Microsoft\Windows\WindowsUpdate\%%~nx?" /disable >nul 2>&1
  261. icacls "%systemroot%\System32\Tasks\Microsoft\Windows\WindowsUpdate\*" /inheritance:r /remove *S-1-5-32-544 *S-1-5-11 *S-1-5-32-545 *S-1-5-18 >nul 2>&1
  262. ::::::::::::::::::::::::::::
  263. ::Set list (s32list) of update hijacker files to be disabled, then disable everything in the list.
  264. set s32list=EOSNotify.exe WaaSMedic.exe WaasMedicSvc.dll WaaSMedicPS.dll WaaSAssessment.dll UsoClient.exe
  265. set s32list=%s32list% SIHClient.exe MusNotificationUx.exe MusNotification.exe osrss.dll
  266. set s32=%systemroot%\System32
  267. ::If "s32list" files were previously renamed by script, restore original file names
  268. for %%# in (%s32list%) do (
  269. ren "%s32%\%%#"-backup "%%#" >nul 2>&1
  270. if exist "%s32%\%%#" del "%s32%\%%#"-backup /f /q >nul 2>&1
  271. )
  272. ::Lock files
  273. for %%# in (%s32list%) do (
  274. takeown /f "%s32%\%%#" /a >nul 2>&1
  275. icacls "%s32%\%%#" /reset >nul 2>&1
  276. if exist "%s32%\%%#" %nsudovar% -ShowWindowMode:Hide -Wait -U:T -P:E "%systemroot%\System32\icacls.exe" "%s32%\%%#" /inheritance:r /remove *S-1-5-32-544 *S-1-5-11 *S-1-5-32-545 *S-1-5-18 >nul 2>&1
  277. )
  278. ::If files in "s32list" aren't locked for whatever reason, rename them.
  279. for %%# in (%s32list%) do (
  280. ren "%s32%\%%#" "%%#"-backup >nul 2>&1
  281. if exist "%s32%\%%#"-backup del "%s32%\%%#" /f /q >nul 2>&1
  282. )
  283. ::::::::::::::::::::::::::::
  284. :: Create WDU.cmd
  285. (
  286. echo ::Allow only WDU task to run this file::
  287. echo whoami /user /nh ^| find /i "S-1-5-18" ^|^| exit
  288. echo cd /d "%%~dp0"
  289. echo ::Wait 5 minutes to prevent resource hogging after reboot with missed update::
  290. echo timeout /t 300^>nul
  291. echo ::If WUMT or WuMgr are running, cancel Defender update and exit. If not, continue::
  292. echo tasklist ^| findstr /i "wumt_x86.exe wumt_x64.exe wumgr.exe" ^&^& exit 1
  293. echo ::If Windows Defender is running, update it. If not, cancel Defender update and exit::
  294. echo sc query ^| find /i "windefend" ^|^| exit 1
  295. echo ::Enable Windows Update service and update Defender, then disable Update Service::
  296. echo wub.exe /e
  297. echo timeout /t 10
  298. echo "%%ProgramFiles%%\Windows Defender\MpCmdRun.exe" -SignatureUpdate
  299. echo wub.exe /d /p
  300. echo exit /b %%errorlevel%%
  301. )>.\bin\wdu.cmd"
  302. ::::::::::::::::::::::::::::
  303. ::Create WDU task, and wub_task
  304. call :create_task WDU "Windows Defender Update"
  305. call :create_task Wub_task "Windows Update Blocker Auto-Renewal"
  306. ::::::::::::::::::::::::::::
  307. echo.&echo Windows 10 updates disabled.
  308. echo Close window ^(click "X"^) if done, or press a key to check for updates...
  309. pause >nul 2>&1
  310. :splash
  311. cls
  312. echo.
  313. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ::::::::::::::::::::::::::::::::
  314. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ : ^ Welcome to manual updates! ^ :
  315. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ::::::::::::::::::::::::::::::::
  316. echo.
  317. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ The Windows Update Service is now DISABLED and stopped.
  318. echo ^ ^ The tasks "WDU" (Windows Defender Update) and "wub_task" (Forces Update service off
  319. echo ^ ^ ^ ^ ^ ^ ^ ^ after reboot and login) have been (re)created.
  320. echo.
  321. echo ^ * ^ Update Hijackers are now disabled! (see readme for details)
  322. echo ^ * ^ If you just want to disable the Update Hijackers and not check for or install
  323. echo ^ ^ ^ ^ updates, you may close this screen now.
  324. echo.
  325. echo ^ * ^ If you choose to review any available Windows updates, the script enables and
  326. echo ^ ^ ^ ^ starts only the Windows Update Service, then runs the Windows update Manager
  327. echo ^ ^ ^ ^ (WuMgr) or the Windows Update MiniTool (WUMT) to find and then hide or install
  328. echo ^ ^ ^ ^ selected Windows updates. If you run WUMT, don't change WUMT settings while
  329. echo ^ ^ ^ ^ running this script. If WuMgr or WUMT is offering updates, you need to hide or
  330. echo ^ ^ ^ ^ install them before closing WuMgr or WUMT.
  331. echo.
  332. echo ^ * ^ After checking for updates, the script stops and disables the Windows Update service
  333. echo ^ ^ ^ ^ when WuMgr or WUMT is closed whether or not the service was previously enabled.
  334. echo.
  335. echo ^ * ^ If you choose to use the Store, you can enable update service in Configurator.
  336. echo ^ ^ ^ ^ After using the Store, then either 1) disable update service or 2) continue script to
  337. echo ^ ^ ^ ^ check for Windows updates with WuMgr or WUMT after which the update service will be
  338. echo ^ ^ ^ ^ disabled.
  339. echo.
  340. echo ^ * ^ If you move this script to another folder run it again so the tasks will work!
  341. echo.
  342. echo ^ * ^ The included uninstaller undoes script changes.
  343. echo.&echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ---^>^>^> Press any key to continue. ^<^<^<---
  344. pause > nul
  345. ::::::::::::::::::::::::::::
  346. ::Internet connection check
  347. cls
  348. set state=
  349. set servers=download.windowsupdate.com internetbeacon.msedge.net www.microsoft.com Bing.com 0x0.st baidu.com
  350. set servers=%servers% www.google.com www.facebook.com www.youtube.com www.yahoo.com www.baidu.com www.wikipedia.org www.live.com www.qq.com
  351. set servers=%servers% www.twitter.com www.taobao.com www.blogspot.com www.linkedin.com www.ebay.com www.yandex.ru www.wordpress.com www.vk.com
  352. echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.
  353. echo.
  354. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ Internet connection test...
  355. echo.
  356. for %%i in (%servers%) do (call :internetcheck %%i)
  357. call :internetcheckerror
  358. :internetcheck
  359. set state=up
  360. powershell -Nologo -NoProfile -ExecutionPolicy Bypass "$ProgressPreference='SilentlyContinue';exit (Test-NetConnection %1% -Port 80 -WarningAction SilentlyContinue -InformationLevel Quiet)"
  361. IF %ERRORLEVEL% EQU 0 (set state=down) else (goto postinternetcheck)
  362. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ %1 is %state%
  363. exit /b
  364. :internetcheckerror
  365. echo.&echo Internet connection test failed. &echo Microsoft Store or Windows Updates won't work without internet. &echo. &echo ---^>^>^> Press a key to continue if you're sure internet is working. ^<^<^<--- & echo.&echo It's safe to cancel now if needed. Your system will not be left in an unstable state.&echo ^(Ctrl-C, Alt-F4, or click "X" to cancel and exit^)&pause > nul
  366. :postinternetcheck
  367. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ %1 is %state%
  368. ::::::::::::::::::::::::::::
  369. ::Windows Update Service Configurator
  370. cls
  371. echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.
  372. echo. & echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ Initializing Configurator...
  373. ::disable windows update service except when wumt is run.
  374. :wudisable
  375. call :wuauserv d
  376. cls
  377. echo.
  378. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  379. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ : ^ ^ ^ ^ Sledgehammer - Windows 10 Update Control Configurator ^ ^ ^ ^ :
  380. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  381. echo.
  382. echo ^ ^ ^ ^ ^ ^ ^ ^ ---^>^>^> Windows Update Service is DISABLED and stopped ^(default^) ^<^<^<---
  383. echo.
  384. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ [E]nable Update Service temporarily to use Windows Store.
  385. echo.
  386. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ [1] Continue script to run Windows Update Manager (WuMgr)
  387. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ in auto mode and check for Windows Updates.
  388. echo.
  389. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ [2] Continue script to run Windows Update Minitool (WUMT)
  390. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ in auto mode and check for Windows Updates.
  391. echo.
  392. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ [3] Continue script to run Windows Update Manager (WuMgr)
  393. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ in automatic Offline Mode. *Warning: Wsusscn2.cab is
  394. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ over 500 MB. Download will start immediately.*
  395. echo.
  396. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ [4] Continue script to run Windows Update Manager (WuMgr)
  397. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ in Expert Mode.
  398. echo.
  399. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ [Q]uit script, or "Alt + F4", or close window, if you're
  400. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ just verifying or are finished changing the update
  401. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ service setting. It stays how it's set above.
  402. echo.
  403. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ The Windows Update service will be automatically
  404. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ started and stopped.
  405. echo.&echo.
  406. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ Please select [E], [1], [2], [3], [4], or [Q]
  407. CHOICE /C E1234Q /M "Your choice?:" >nul 2>&1
  408. if %errorlevel%==6 (exit)
  409. if %errorlevel%==5 (set "WuMgr=E"&goto :WuMgrExpertMode)
  410. if %errorlevel%==4 (set "WuMgr=O"&goto :WuMgrOfflineMode)
  411. if %errorlevel%==3 (goto :StartUpdate)
  412. if %errorlevel%==2 (set "WuMgr=Y"&goto :StartUpdate)
  413. cls
  414. echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.
  415. echo.&echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ Please wait while Windows Update Service is enabled...
  416. ::enable windows update service
  417. :wuenable
  418. call :wuauserv e
  419. cls
  420. echo.&echo.
  421. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  422. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ : ^ ^ ^ ^ Sledgehammer - Windows 10 Update Control Configurator ^ ^ ^ ^ :
  423. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  424. echo.
  425. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ---^>^>^> Windows Update Service is ENABLED ^(for Store^) ^<^<^<---
  426. echo.
  427. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ [D]isable Update Service when finished using Store.
  428. echo.
  429. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ [1] Continue script to run Windows Update Manager (WuMgr)
  430. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ in auto mode and check for Windows Updates.
  431. echo.
  432. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ [2] Continue script to run Windows Update Minitool (WUMT)
  433. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ in auto mode and check for Windows Updates.
  434. echo.
  435. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ [3] Continue script to run Windows Update Manager (WuMgr)
  436. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ in automatic Offline Mode. *Warning: Wsusscn2.cab is
  437. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ over 500 MB. Download will start immediately.*
  438. echo.
  439. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ [4] Continue script to run Windows Update Manager (WuMgr)
  440. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ in Expert Mode.
  441. echo.
  442. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ The Windows Update service will be automatically
  443. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ started and stopped.
  444. echo.
  445. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ Please select [D], [1], [2], [3], or [4]
  446. echo.
  447. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  448. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ :^ Don't close this window or update service will stay on!!!^ :
  449. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ : ^ ^ Don't worry. Just run the script again to turn it off ^ ^ :
  450. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  451. CHOICE /C D1234 /M "Your choice?:" >nul 2>&1
  452. if %errorlevel%==5 (set "WuMgr=E"&goto :WuMgrExpertMode)
  453. if %errorlevel%==4 (set "WuMgr=O"&goto :WuMgrOfflineMode)
  454. if %errorlevel%==3 (goto :StartUpdate)
  455. if %errorlevel%==2 (set "WuMgr=Y"&goto :StartUpdate)
  456. if %errorlevel%==1 (
  457. cls
  458. echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.
  459. echo.&echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ Please wait while Windows Update Service is disabled...
  460. goto wudisable
  461. )
  462. ::::::::::::::::::::::::::::
  463. :create_task
  464. set "w=echo f.writeline "
  465. echo Set Fso=CreateObject^("Scripting.FileSystemObject"^):Set f=Fso.CreateTextFile^(fso.GetParentFolderName^(WScript.ScriptFullName^) ^& "\task.xml",True,True^)>task.vbs
  466. if /i %1==wdu (
  467. rem Create automatic Windows Defender Update "WDU" task that updates Defender only if it's enabled and running.
  468. rem Create WDU.xml
  469. rem
  470. rem
  471. rem Creating Windows Defender Update auto renewal task
  472. rem
  473. (
  474. %w%"<?xml version=""1.0"" encoding=""UTF-16""?>"
  475. %w%"<Task version=""1.2"" xmlns=""http://schemas.microsoft.com/windows/2004/02/mit/task"">"
  476. %w%"<RegistrationInfo>"
  477. %w%"<Date>2016-02-18T08:29:39</Date>"
  478. %w%"<Author>pf100\rpo</Author>"
  479. %w%"<URI>WindowsDefenderUpdate</URI>"
  480. %w%"</RegistrationInfo>"
  481. %w%"<Triggers>"
  482. %w%"<CalendarTrigger>"
  483. %w%"<StartBoundary>2016-01-01T00:01:00</StartBoundary>"
  484. %w%"<Enabled>true</Enabled>"
  485. %w%"<ScheduleByDay>"
  486. %w%"<DaysInterval>1</DaysInterval>"
  487. %w%"</ScheduleByDay>"
  488. %w%"</CalendarTrigger>"
  489. %w%"<CalendarTrigger>"
  490. %w%"<StartBoundary>2016-01-01T06:01:00</StartBoundary>"
  491. %w%"<Enabled>true</Enabled>"
  492. %w%"<ScheduleByDay>"
  493. %w%"<DaysInterval>1</DaysInterval>"
  494. %w%"</ScheduleByDay>"
  495. %w%"</CalendarTrigger>"
  496. %w%"<CalendarTrigger>"
  497. %w%"<StartBoundary>2016-01-01T12:01:00</StartBoundary>"
  498. %w%"<Enabled>true</Enabled>"
  499. %w%"<ScheduleByDay>"
  500. %w%"<DaysInterval>1</DaysInterval>"
  501. %w%"</ScheduleByDay>"
  502. %w%"</CalendarTrigger>"
  503. %w%"<CalendarTrigger>"
  504. %w%"<StartBoundary>2016-01-01T18:01:00</StartBoundary>"
  505. %w%"<Enabled>true</Enabled>"
  506. %w%"<ScheduleByDay>"
  507. %w%"<DaysInterval>1</DaysInterval>"
  508. %w%"</ScheduleByDay>"
  509. %w%"</CalendarTrigger>"
  510. %w%"<BootTrigger>"
  511. %w%"<Enabled>true</Enabled>"
  512. %w%"<Delay>PT10M</Delay>"
  513. %w%"</BootTrigger>"
  514. %w%"<LogonTrigger>"
  515. %w%"<Enabled>true</Enabled>"
  516. %w%"</LogonTrigger>"
  517. %w%"</Triggers>"
  518. %w%"<Principals>"
  519. %w%"<Principal id=""Author"">"
  520. %w%"<UserId>S-1-5-18</UserId>"
  521. %w%"<RunLevel>HighestAvailable</RunLevel>"
  522. %w%"</Principal>"
  523. %w%"</Principals>"
  524. %w%"<Settings>"
  525. %w%"<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>"
  526. %w%"<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>"
  527. %w%"<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>"
  528. %w%"<AllowHardTerminate>true</AllowHardTerminate>"
  529. %w%"<StartWhenAvailable>false</StartWhenAvailable>"
  530. %w%"<RunOnlyIfNetworkAvailable>true</RunOnlyIfNetworkAvailable>"
  531. %w%"<IdleSettings>"
  532. %w%"<StopOnIdleEnd>false</StopOnIdleEnd>"
  533. %w%"<RestartOnIdle>false</RestartOnIdle>"
  534. %w%"</IdleSettings>"
  535. %w%"<AllowStartOnDemand>true</AllowStartOnDemand>"
  536. %w%"<Enabled>true</Enabled>"
  537. %w%"<Hidden>false</Hidden>"
  538. %w%"<RunOnlyIfIdle>false</RunOnlyIfIdle>"
  539. %w%"<WakeToRun>false</WakeToRun>"
  540. %w%"<ExecutionTimeLimit>P3D</ExecutionTimeLimit>"
  541. %w%"<Priority>7</Priority>"
  542. %w%"</Settings>"
  543. %w%"<Actions Context=""Author"">"
  544. %w%"<Exec>"
  545. %w%"<Command>""" ^& FSO.GetParentFolderName^(Wscript.ScriptFullName^) ^& "\bin\WDU.cmd" ^& """</Command>"
  546. %w%"</Exec>"
  547. %w%"</Actions>"
  548. %w%"</Task>"
  549. )>>task.vbs
  550. )
  551. if /i %1==wub_task (
  552. rem
  553. rem Create Windows Update Blocker "Wub_task" that sets your desired Windows Update service state at boot.
  554. rem
  555. rem Create Wub_task
  556. rem
  557. rem
  558. (
  559. %w%"<?xml version=""1.0"" encoding=""UTF-16""?>"
  560. %w%"<Task version=""1.2"" xmlns=""http://schemas.microsoft.com/windows/2004/02/mit/task"">"
  561. %w%"<RegistrationInfo>"
  562. %w%"<Date>2016-02-18T08:29:39</Date>"
  563. %w%"<Author>pf100\rpo</Author>"
  564. %w%"<URI>\wub_task</URI>"
  565. %w%"</RegistrationInfo>"
  566. %w%"<Triggers>"
  567. %w%"<BootTrigger>"
  568. %w%"<Enabled>true</Enabled>"
  569. %w%"</BootTrigger>"
  570. %w%"<LogonTrigger>"
  571. %w%"<Enabled>true</Enabled>"
  572. %w%"</LogonTrigger>"
  573. %w%"</Triggers>"
  574. %w%"<Principals>"
  575. %w%"<Principal id=""Author"">"
  576. %w%"<RunLevel>HighestAvailable</RunLevel>"
  577. %w%"</Principal>"
  578. %w%"</Principals>"
  579. %w%"<Settings>"
  580. %w%"<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>"
  581. %w%"<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>"
  582. %w%"<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>"
  583. %w%"<AllowHardTerminate>true</AllowHardTerminate>"
  584. %w%"<StartWhenAvailable>true</StartWhenAvailable>"
  585. %w%"<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>"
  586. %w%"<IdleSettings>"
  587. %w%"<StopOnIdleEnd>false</StopOnIdleEnd>"
  588. %w%"<RestartOnIdle>false</RestartOnIdle>"
  589. %w%"</IdleSettings>"
  590. %w%"<AllowStartOnDemand>true</AllowStartOnDemand>"
  591. %w%"<Enabled>true</Enabled>"
  592. %w%"<Hidden>false</Hidden>"
  593. %w%"<RunOnlyIfIdle>false</RunOnlyIfIdle>"
  594. %w%"<WakeToRun>false</WakeToRun>"
  595. %w%"<ExecutionTimeLimit>PT72H</ExecutionTimeLimit>"
  596. %w%"<Priority>7</Priority>"
  597. %w%"</Settings>"
  598. %w%"<Actions Context=""Author"">"
  599. %w%"<Exec>"
  600. %w%"<Command>""" ^& FSO.GetParentFolderName^(Wscript.ScriptFullName^) ^& "\bin\Wub.exe""</Command>"
  601. %w%"<Arguments>/d /p</Arguments>"
  602. %w%"</Exec>"
  603. %w%"</Actions>"
  604. %w%"</Task>"
  605. )>>task.vbs
  606. )
  607. echo f.Close>>task.vbs & task.vbs
  608. ::
  609. schtasks /delete /tn "%1" /f >nul 2>&1
  610. schtasks /create /tn "\Microsoft\Sledgehammer\%1" /ru "SYSTEM" /xml task.xml /F >nul 2>&1 || (
  611. cls&echo.&echo Creating %2 %1 task errored.&echo.&echo.&echo Press any key to exit... & pause > nul &exit)
  612. del task.vbs task.xml >nul 2>&1
  613. exit /b
  614. ::::::::::::::::::::::::::::
  615. :wuauserv
  616. if /i "%1"=="e" (set "wub=wub.exe /e" & set "status=True") else (set "wub=wub.exe /d /p" & set "status=False")
  617. .\bin\%wub%
  618. timeout -t 1 > nul
  619. set /a "max_retry=10" & set /a "i=0"
  620. :wuauserv1
  621. if %i%==%max_retry% (echo Operation did not complete within %max_retry% s. Press any key do exit...&pause>nul&exit)
  622. set /a "i+=1"
  623. WMIC Service WHERE "Name = 'Wuauserv'" GET Started | find /i "%status%" >nul && exit /b || (timeout /t 1 >nul & goto :wuauserv1)
  624. ::::::::::::::::::::::::::::
  625. :StartUpdate
  626. cls
  627. (
  628. echo @echo off
  629. echo :loop
  630. echo net start wuauserv
  631. echo timeout /t 10
  632. echo goto loop
  633. )>WU-keep-alive.cmd
  634. (
  635. echo @echo off
  636. echo cd /d "%%~dp0"
  637. echo del WU-keep-alive.cmd
  638. echo .\bin\wub.exe /d /p
  639. echo del close.cmd ^& exit
  640. )>close.cmd
  641. rem if "WuMgr%"=="E" (goto WuMgrExpertMode)
  642. rem if "WuMgr%"=="O" (goto WuMgrOfflineMode)
  643. if not defined WuMgr (
  644. set check_updates="%wumt%" -update "-onclose close.cmd"
  645. ) else (
  646. set check_updates=.\bin\wumgr.exe -update -online 7971f918-a847-4430-9279-4a52d1efe18d -provisioned -onclose close.cmd)
  647. call :wuauserv e
  648. echo CreateObject^("WScript.Shell"^).Run "WU-keep-alive.cmd",0 >WU-keep-alive.vbs&WU-keep-alive.vbs&del WU-keep-alive.vbs
  649. Start "" %check_updates%
  650. exit
  651. :WuMgrOfflineMode
  652. cls
  653. (
  654. echo @echo off
  655. echo :loop
  656. echo net start wuauserv
  657. echo timeout /t 10
  658. echo goto loop
  659. )>WU-keep-alive.cmd
  660. (
  661. echo @echo off
  662. echo cd /d "%%~dp0"
  663. echo del WU-keep-alive.cmd
  664. echo .\bin\wub.exe /d /p
  665. echo del close.cmd ^& exit
  666. )>close.cmd
  667. set check_updates=.\bin\wumgr.exe -update -offline 7971f918-a847-4430-9279-4a52d1efe18d -onclose close.cmd
  668. call :wuauserv e
  669. echo CreateObject^("WScript.Shell"^).Run "WU-keep-alive.cmd",0 >WU-keep-alive.vbs&WU-keep-alive.vbs&del WU-keep-alive.vbs
  670. Start "" %check_updates%
  671. exit
  672. :WuMgrExpertMode
  673. cls
  674. (
  675. echo @echo off
  676. echo :loop
  677. echo net start wuauserv
  678. echo timeout /t 10
  679. echo goto loop
  680. )>WU-keep-alive.cmd
  681. (
  682. echo @echo off
  683. echo cd /d "%%~dp0"
  684. echo del WU-keep-alive.cmd
  685. echo .\bin\wub.exe /d /p
  686. echo del close.cmd ^& exit
  687. )>close.cmd
  688. set check_updates=.\bin\wumgr.exe 7971f918-a847-4430-9279-4a52d1efe18d -onclose close.cmd
  689. call :wuauserv e
  690. echo CreateObject^("WScript.Shell"^).Run "WU-keep-alive.cmd",0 >WU-keep-alive.vbs&WU-keep-alive.vbs&del WU-keep-alive.vbs
  691. Start "" %check_updates%
  692. exit
Advertisement
Add Comment
Please, Sign In to add comment