Advertisement
pf100

WUMTWrapperScript.cmd v2.3.8

Jun 24th, 2018
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.73 KB | None | 0 0
  1. @echo off
  2. mode con cols=85 lines=12
  3. Title WUMT Wrapper Script 2.3.8
  4. Color 1F & goto start
  5. Original script by pf100 @ MDL with special thanks to rpo and abbodi1406 @ MDL for code improvements.
  6. Project page and source code:
  7. https://forums.mydigitallife.net/threads/72203-WUMT-Wrapper-script-controls-windows-update-service
  8. ******************************************************************
  9. You may freely modify this script as you wish, I only request that you leave the credits and the
  10. link to the original script.
  11. ******************************************************************
  12. This script provides manual updating for Windows 10 including Home versions.
  13. Update Windows 10 on your schedule, not Microsoft's.
  14. I originally wrote this script for personal use because of the lack of update options with the
  15. original RTM release of Windows 10 Pro. I wanted to update Windows 10 when I had the free time
  16. to manually update, just like I did with previous versions of Windows that allowed me to
  17. set updates to manual, not when Microsoft forced it on me while I was busy using my computer.
  18. *******************************************************************
  19. WUMT is available here: https://forums.mydigitallife.net/threads/64939-Windows-Update-MiniTool
  20. Windows Update Blocker is available here: https://www.dropbox.com/s/a67qj0qzbmx59bm/wub.exe?dl=1
  21. Only use Windows Update Blocker v1.0 with this script, not v1.1.
  22. *******************************************************************
  23. How it works: The script first checks if the OS is Windows 7 or older and if so
  24. it bypasses the Windows 10 Update Hijacker disable portion of the script.
  25. This script creates a smart Windows Defender Update task "WUD" that updates Windows
  26. Defender if it's running and enabled, and doesn't update it if it's not running and disabled,
  27. auto-elevates, uninstalls and removes the Windows 10 Update Assistant, renames the
  28. %programfiles%\rempl* folder, resets and removes permissions from and disables these
  29. Update Hijackers:
  30. remsh.exe*
  31. osrss.dll
  32. UsoClient.exe
  33. WaaSMedic.exe
  34. WaasMedicSvc.dll
  35. WaaSMedicPS.dll
  36. WaaSAssessment.dll
  37. MusNotificationUx.exe
  38. SIHClient.exe
  39. makes sure the task "wub_task" is installed that runs wub at boot (to stop updates from turning
  40. updates back on), runs wub.exe and enables and starts the windows update service (wuauserv) if
  41. disabled (*wub can be disabled using the included Configurator.cmd script, leaving Windows Updates
  42. always running so you can use Store and Defender at any time), then runs the correct version of
  43. the Windows Update MiniTool in "auto search for updates" mode for your OS version's architecture
  44. (x86 or x64), then disables and stops wuauserv giving you full control. No more forced automatic
  45. updates or surprise reboots. This was written for Windows 10 Pro and Home, but works with all
  46. versions of Windows 10. Don't change any settings in lower left of WUMT while running the script.
  47. *******************************************************************
  48. I also included an uninstaller.cmd that deletes the WDU and wub_task tasks, deletes the WDU.cmd
  49. file used by WDU task, restores the rempl folder, resets Update Hijacker permissions to how they
  50. were originally, and turns off wub (if enabled) which turns the windows update service on automatic
  51. again, undoing everything done by the script. If you uninstall after having used the installer the
  52. script folder is removed also.
  53. *******************************************************************
  54. Configurator leaves the Update Hijackers disabled, but gives you the option of turning on the windows
  55. update service temporarily to use Store, or leave it on permanently to use Store anytime.
  56. *******************************************************************
  57. *If you need to install .Net 3.5 or use the Windows 10 Store or something that needs wuauserv
  58. running, run the script and after it enables wuauserv and starts WUMT, install what you need
  59. after WUMT checks for updates, before closing WUMT. If you ran the Configurator to "leave
  60. the Windows Update Service running at all times" you can ignore this note as the store will
  61. work at any time.
  62. *******************************************************************
  63. :start
  64. :::::::::::::::::::::::::::::::::::::::::
  65. :: Automatically check & get admin rights
  66. :::::::::::::::::::::::::::::::::::::::::
  67. :: ECHO.
  68. :: ECHO =============================
  69. :: ECHO Running Admin shell
  70. :: ECHO =============================
  71. :: Check Privileges
  72. :: Get Privileges
  73. :: and
  74. :: Invoke UAC for Privilege Escalation
  75. :: Notify if error escalating
  76. :: and prevent looping if escalation fails
  77. ::::::::::::::::::::::::::::
  78. set "params=Problem_with_elevating_UAC_for_Administrator_Privileges"&if exist "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs"
  79. fsutil dirty query %systemdrive% >nul 2>&1 && goto :GotPrivileges
  80. :: The following test is to avoid infinite looping if elevating UAC for Administrator Privileges failed
  81. 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)
  82. cmd /u /c echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "%~0", "%params%", "", "runas", 1 > "%temp%\getadmin.vbs"&cscript //nologo "%temp%\getadmin.vbs"&exit
  83. :GotPrivileges
  84. ::::::::::::::::::::::::::::
  85. ::START
  86. ::Uninstall and remove Windows 10 Update assistant.
  87. ::Disable Windows Update Service until script menu screen.
  88. ::Reset (in case of wrong Permissions), remove Permissions from and Disable UsoClient.exe,
  89. ::WaaSMedic.exe, WaasMedicSvc.dll, WaaSMedicPS.dll, WaaSAssessment.dll, MusNotificationUx.exe, and SIHClient.exe.
  90. ::Kill remsh.exe if it's running.
  91. ::Rename the folder %ProgramFiles%\rempl to %ProgramFiles%\rempl-backup if it exists.
  92. ::Install wub_task (prevents Windows Update service from starting after installing updates and rebooting).
  93. ::Enable and start the Windows Update Service (wuauserv).
  94. ::Run the correct version of WUMT for your architecture.
  95. ::Start WUMT in "auto-check for updates" mode.
  96. ::After updates are completed and WUMT is closed and/or the "reboot"
  97. ::button in WUMT is pressed, silently run wub.exe and disable and stop wuauserv
  98. ::::::::::::::::::::::::::::
  99. @echo off
  100. cls
  101. echo.
  102. echo Please wait...
  103. rem Get Windows OS build number
  104. for /f "tokens=2 delims==" %%a in ('wmic path Win32_OperatingSystem get BuildNumber /value') do (
  105. set /a WinBuild=%%a
  106. )
  107. rem Test for Windows versions below Windows 10 and if so just install wub_task and start wumt.
  108. if %winbuild% LEQ 9600 (
  109. rem Sanity check if script copied over different version of script:
  110. rem If somehow both files "wub.exe" and "wub.exe-backup" exist, delete "wub.exe-backup"
  111. rem If only wub.exe-backup exists, rename it to wub.exe
  112. (if exist "%~dp0wub.exe" (del "%~dp0wub.exe-backup" /f /q) else (ren "%~dp0wub.exe-backup" wub.exe)) >nul 2>&1
  113.  
  114. call :Install_wub_task
  115. goto :StartWUMT
  116. )
  117. if exist "%systemdrive%\Windows10Upgrade\Windows10UpgraderApp.exe" ( echo Windows 10 Update Assistant detected. Preparing to uninstall.
  118. echo The "Windows 10 Update Assistant has stopped working" dialog box may pop up. If so, just close it.
  119. echo Press a key to acknowledge this and please wait for the uninstall to finish.
  120. echo Script will continue after uninstall and removal is completed...
  121. pause > nul
  122. echo Uninstalling Windows 10 Update Assistant...
  123. %systemdrive%\Windows10Upgrade\Windows10UpgraderApp.exe /forceuninstall
  124. timeout /t 10 /nobreak >nul 2>&1
  125. del %systemroot%\UpdateAssistant\*.* /f /q >nul 2>&1
  126. rmdir %systemroot%\UpdateAssistant /s /q >nul 2>&1
  127. del %SystemDrive%\Windows10Upgrade\*.* /f /q >nul 2>&1
  128. rmdir %SystemDrive%\Windows10Upgrade /s /q >nul 2>&1
  129. cls
  130. echo Windows 10 Update Assistant removed.
  131. echo Press a key to continue...
  132. pause > nul )
  133. cls
  134. ::::::::::::::::::::::::::::
  135. ::Create automatic Windows Defender Update "WDU" task that updates Defender only if it's enabled and running.
  136. ::Create Windows Update Blocker "Wub_task" that sets your desired Windows Update service state at boot.
  137. cls
  138. echo.
  139. echo Please wait...
  140. call :Install_wub_task >nul 2>&1
  141. cls
  142. echo.
  143. echo Please wait...
  144. call :Install_wdu_task >nul 2>&1
  145. ::::::::::::::::::::::::::::
  146. del %systemroot%\UpdateAssistantV2\*.* /f /q >nul 2>&1
  147. rmdir %systemroot%\UpdateAssistantV2 /s /q >nul 2>&1
  148. ::::::::::::::::::::::::::::
  149. ::Check if update service is running or not and then delete correct file
  150. sc query | find /i "wuauserv" > nul & if errorlevel 1 (if exist "%~dp0wub.exe" del "%~dp0wub.exe-backup" /f /q >nul 2>&1
  151. ) else (
  152. if exist "%~dp0wub.exe-backup" del "%~dp0wub.exe" /f /q >nul 2>&1)
  153. ::::::::::::::::::::::::::::
  154. ::If somehow both files "wub.exe" and "wub.exe-backup" exist after the previous check, delete "wub.exe-backup"
  155. if exist "%~dp0wub.exe" if exist "%~dp0wub.exe-backup" del "%~dp0wub.exe-backup" /f /q >nul 2>&1
  156. ::::::::::::::::::::::::::::
  157. "%~dp0wub.exe" /d /p >nul 2>&1
  158. ::::::::::::::::::::::::::::
  159. ::Remove ability for the following files to be executed
  160. takeown /f "%systemroot%\System32\osrss.dll" /a >nul 2>&1
  161. icacls "%systemroot%\System32\osrss.dll" /reset >nul 2>&1
  162. icacls "%systemroot%\System32\osrss.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
  163. ::::::::::::::::::::::::::::
  164. takeown /f "%systemroot%\System32\UsoClient.exe" /a >nul 2>&1
  165. icacls "%systemroot%\System32\UsoClient.exe" /reset >nul 2>&1
  166. 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
  167. ::::::::::::::::::::::::::::
  168. takeown /f "%systemroot%\System32\WaaSMedic.exe" /a >nul 2>&1
  169. icacls "%systemroot%\System32\WaaSMedic.exe" /reset >nul 2>&1
  170. 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
  171. ::::::::::::::::::::::::::::
  172. takeown /f "%systemroot%\System32\WaasMedicSvc.dll" /a >nul 2>&1
  173. icacls "%systemroot%\System32\WaasMedicSvc.dll" /reset >nul 2>&1
  174. 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
  175. ::::::::::::::::::::::::::::
  176. takeown /f "%systemroot%\System32\WaaSMedicPS.dll" /a >nul 2>&1
  177. icacls "%systemroot%\System32\WaaSMedicPS.dll" /reset >nul 2>&1
  178. 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
  179. ::::::::::::::::::::::::::::
  180. takeown /f "%systemroot%\System32\WaaSAssessment.dll" /a >nul 2>&1
  181. icacls "%systemroot%\System32\WaaSAssessment.dll" /reset >nul 2>&1
  182. 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
  183. ::::::::::::::::::::::::::::
  184. takeown /f "%systemroot%\System32\SIHClient.exe" /a >nul 2>&1
  185. icacls "%systemroot%\System32\SIHClient.exe" /reset >nul 2>&1
  186. 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
  187. ::::::::::::::::::::::::::::
  188. takeown /f "%systemroot%\System32\MusNotificationUx.exe" /a >nul 2>&1
  189. icacls "%systemroot%\System32\MusNotificationUx.exe" /reset >nul 2>&1
  190. 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
  191. ::::::::::::::::::::::::::::
  192. ::Disable remsh
  193. taskkill /im remsh.exe /f >nul 2>&1
  194. if exist "%ProgramFiles%\rempl" rmdir /s /q "%ProgramFiles%\rempl-backup" >nul 2>&1
  195. ren "%ProgramFiles%\rempl" rempl-backup >nul 2>&1
  196. ::::::::::::::::::::::::::::
  197. :refresh
  198. cls
  199. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ WUMT Wrapper Script Windows Update Service Configurator & echo.
  200. sc query | find /i "wuauserv" > nul & if errorlevel 1 (goto wudisabled) ELSE (goto wuenabled)
  201. :wudisabled
  202. echo ^ ^ ^ ^ ^ ^ ---^>^>^> Windows Update Service is DISABLED and stopped ^(default^) ^<^<^<---
  203. echo. & echo [E]nable Update Service to allow Windows Store.
  204. echo. & echo [C]ontinue script if above Update Service Status is okay...
  205. echo. & echo E[x]it script if you're just verifying or changing the update service status... & echo.
  206. CHOICE /C ECX /M "Your choice?:"
  207. if %errorlevel%==3 (exit)
  208. if %errorlevel%==2 (goto splash)
  209. if %errorlevel%==1 (
  210. start "" /w "%~dp0wub.exe" /e >nul 2>&1
  211. ping 127.0.0.1 -n 1 -w 500> nul
  212. ren "%~dp0wub.exe" wub.exe-backup >nul 2>&1
  213. ping 127.0.0.1 -n 1 -w 500> nul
  214. echo. & goto refresh
  215. )
  216. :wuenabled
  217. echo ^ ^ ^ ^ ^ ^ ---^>^>^> Windows Update Service is ENABLED and running ^(for Store^) ^<^<^<---
  218. echo. & echo [D]isable Update Service and only allow to run during updates with script (default).
  219. echo. & echo [C]ontinue script if above Update Service Status is okay...
  220. echo. & echo E[x]it script if you're just verifying or changing the update service status... & echo.
  221. CHOICE /C DCX /M "Your choice?:"
  222. if %errorlevel%==3 (exit)
  223. if %errorlevel%==2 (goto splash)
  224. if %errorlevel%==1 (
  225. ren "%~dp0wub.exe-backup" wub.exe >nul 2>&1
  226. ping 127.0.0.1 -n 1 -w 500> nul
  227. start "" /w "%~dp0wub.exe" /d /p >nul 2>&1
  228. ping 127.0.0.1 -n 1 -w 500> nul
  229. echo. & goto refresh
  230. )
  231. ::::::::::::::::::::::::::::
  232. :splash
  233. mode con cols=56 lines=33
  234. cls
  235. echo ***********************************************
  236. echo Welcome to manual updates! & echo.
  237. sc query | find /i "wuauserv" > nul & if errorlevel 1 (echo Windows Update Service is DISABLED and stopped ^(default^)
  238. ) else (echo Windows Update Service is ENABLED and set to ALWAYS run.)
  239. echo.
  240. echo Press any key to check for updates, or close this screen
  241. echo ^ ^ ^ ^ ^ to cancel and leave updates turned off
  242. echo ^ ^ ^ ^ ^ (unless overridden with configurator). & echo.
  243. echo ***********************************************
  244. echo Automatic updates are now turned off (unless overriden
  245. echo with Configurator). This script automates the update
  246. echo process. It automatically disables a range of "Update
  247. echo Hijackers" such as: osrss, remsh, Uso, WaaS, SIH, and
  248. echo Update Assistant. Enables and starts only the Windows
  249. echo Update Service, runs the Windows Update MiniTool (WUMT).
  250. echo After updates, stops and disables the Windows Update
  251. echo service (unless overriden with Configurator). The
  252. echo included uninstaller undoes script changes. Closing WUMT
  253. echo at any time disables updates again (unless overriden
  254. echo with Configurator); however, if WUMT is already offering
  255. echo updates, you need to hide them and/or install them
  256. echo one-by-one before closing WUMT or it may install them
  257. echo without asking next time. Don't change WUMT settings
  258. echo while running this script. If an update requires a
  259. echo reboot, re-run the script after the reboot and just
  260. echo close the first screen to make sure the "Update
  261. echo Hijackers" stay off. Enable update service in
  262. echo Configurator in script to use the Store at the risk of
  263. echo possible unwanted updates if you leave it on. Better to
  264. echo enable updates, use store, then disable updates. Use at
  265. echo your discretion.
  266. echo ***********************************************
  267. echo Press any key to run Windows Update MiniTool...
  268. pause > nul
  269. :StartWUMT
  270. "%~dp0wub.exe" /e
  271. :: Check OS and run correct version of WUMT
  272. for /f "tokens=2 delims==" %%a in ('wmic cpu get AddressWidth /value') do (set arch=%%a)
  273. IF %arch% == 32 (set "wumt=%~dp0wumt_x86.exe") else (set "wumt=%~dp0wumt_x64.exe")
  274. Start "" "%wumt%" -update "-onclose %~dp0wub.exe /d /p"
  275. goto :EOF
  276. ::
  277. ::
  278. :Install_Wub_task
  279. set "Task_Name=wub_task"
  280. ::
  281. :: Create wbu_task.xml
  282. ::
  283. (
  284. echo ^<?xml version="1.0" encoding="UTF-16"?^>
  285. echo ^<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task"^>
  286. echo ^<RegistrationInfo^>
  287. echo ^<Date^>2018-02-18T08:29:39^</Date^>
  288. echo ^<Author^>pf100\rpo^</Author^>
  289. echo ^<URI^>\wub_task^</URI^>
  290. echo ^</RegistrationInfo^>
  291. echo ^<Triggers^>
  292. echo ^<BootTrigger^>
  293. echo ^<StartBoundary^>2018-02-18T08:29:00^</StartBoundary^>
  294. echo ^<Enabled^>true^</Enabled^>
  295. echo ^</BootTrigger^>
  296. echo ^</Triggers^>
  297. echo ^<Principals^>
  298. echo ^<Principal id="Author"^>
  299. echo ^<UserId^>S-1-5-18^</UserId^>
  300. echo ^<RunLevel^>HighestAvailable^</RunLevel^>
  301. echo ^</Principal^>
  302. echo ^</Principals^>
  303. echo ^<Settings^>
  304. echo ^<MultipleInstancesPolicy^>IgnoreNew^</MultipleInstancesPolicy^>
  305. echo ^<DisallowStartIfOnBatteries^>false^</DisallowStartIfOnBatteries^>
  306. echo ^<StopIfGoingOnBatteries^>false^</StopIfGoingOnBatteries^>
  307. echo ^<AllowHardTerminate^>true^</AllowHardTerminate^>
  308. echo ^<StartWhenAvailable^>false^</StartWhenAvailable^>
  309. echo ^<RunOnlyIfNetworkAvailable^>false^</RunOnlyIfNetworkAvailable^>
  310. echo ^<IdleSettings^>
  311. echo ^<StopOnIdleEnd^>true^</StopOnIdleEnd^>
  312. echo ^<RestartOnIdle^>false^</RestartOnIdle^>
  313. echo ^</IdleSettings^>
  314. echo ^<AllowStartOnDemand^>true^</AllowStartOnDemand^>
  315. echo ^<Enabled^>true^</Enabled^>
  316. echo ^<Hidden^>false^</Hidden^>
  317. echo ^<RunOnlyIfIdle^>false^</RunOnlyIfIdle^>
  318. echo ^<WakeToRun^>false^</WakeToRun^>
  319. echo ^<ExecutionTimeLimit^>PT72H^</ExecutionTimeLimit^>
  320. echo ^<Priority^>7^</Priority^>
  321. echo ^</Settings^>
  322. echo ^<Actions Context="Author"^>
  323. echo ^<Exec^>
  324. echo ^<Command^>"%~dp0wub.exe"^</Command^>
  325. echo ^<Arguments^>/d /p^</Arguments^>
  326. echo ^</Exec^>
  327. echo ^</Actions^>
  328. echo ^</Task^>
  329. )>"%~dp0%Task_Name%.xml"
  330. schtasks /delete /tn "%Task_Name%" /f 1>nul 2>nul
  331. schtasks /query /fo list 2>nul | findstr /i "%Task_Name%" 1>nul || (
  332. echo.&echo Creating Windows Update Blocker Auto-Renewal task %Task_Name%.
  333. schtasks /create /tn "%Task_Name%" /ru "SYSTEM" /xml "%~dp0%Task_Name%.xml" >nul 2>&1 || (
  334. echo.&Creating Windows Update Blocker Auto-Renewal %Task_Name% task errored.& echo Press any key to exit... & pause > nul &exit)
  335. rem echo Windows Update Blocker Auto-Renewal %Task_Name% created.
  336. del /f /q "%~dp0%Task_Name%.xml" >nul 2>&1)
  337. exit /b
  338. ::
  339. ::
  340. :Install_wdu_task
  341. set "Task_Name=WDU"
  342. ::
  343. :: Create WDU.cmd
  344. ::
  345. (
  346. echo rem Don't run this file. It's for use by wrapper script.
  347. echo cd /d "%%~dp0"
  348. echo query ^| find /i "windefend" ^> nul ^& if errorlevel 1 ^(exit^)
  349. echo if not exist wub.exe-backup ^(wub.exe /e^)
  350. echo "%ProgramFiles%\Windows Defender\MpCmdRun.exe" -SignatureUpdate
  351. echo if not exist wub.exe-backup ^(wub.exe /d /p^)
  352. echo exit
  353. )> "%~dp0%Task_Name%.cmd"
  354. ::
  355. :: Create WDU.xml
  356. ::
  357. (
  358. echo ^<?xml version="1.0" encoding="UTF-16"?^>
  359. echo ^<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task"^>
  360. echo ^<RegistrationInfo^>
  361. echo ^<Date^>2018-02-18T08:29:39^</Date^>
  362. echo ^<Author^>pf100\rpo^</Author^>
  363. echo ^<URI^>WindowsDefenderUpdate^</URI^>
  364. echo ^</RegistrationInfo^>
  365. echo ^<Triggers^>
  366. echo ^<CalendarTrigger^>
  367. echo ^<StartBoundary^>2018-05-12T10:35:00.0^</StartBoundary^>
  368. echo ^<Enabled^>true^</Enabled^>
  369. echo ^<ScheduleByDay^>
  370. echo ^<DaysInterval^>1^</DaysInterval^>
  371. echo ^</ScheduleByDay^>
  372. echo ^</CalendarTrigger^>
  373. echo ^</Triggers^>
  374. echo ^<Principals^>
  375. echo ^<Principal id="Author"^>
  376. echo ^<UserId^>S-1-5-18^</UserId^>
  377. echo ^<RunLevel^>HighestAvailable^</RunLevel^>
  378. echo ^</Principal^>
  379. echo ^</Principals^>
  380. echo ^<Settings^>
  381. echo ^<MultipleInstancesPolicy^>IgnoreNew^</MultipleInstancesPolicy^>
  382. echo ^<DisallowStartIfOnBatteries^>false^</DisallowStartIfOnBatteries^>
  383. echo ^<StopIfGoingOnBatteries^>false^</StopIfGoingOnBatteries^>
  384. echo ^<AllowHardTerminate^>true^</AllowHardTerminate^>
  385. echo ^<StartWhenAvailable^>true^</StartWhenAvailable^>
  386. echo ^<RunOnlyIfNetworkAvailable^>true^</RunOnlyIfNetworkAvailable^>
  387. echo ^<IdleSettings^>
  388. echo ^<StopOnIdleEnd^>true^</StopOnIdleEnd^>
  389. echo ^<RestartOnIdle^>false^</RestartOnIdle^>
  390. echo ^</IdleSettings^>
  391. echo ^<AllowStartOnDemand^>true^</AllowStartOnDemand^>
  392. echo ^<Enabled^>true^</Enabled^>
  393. echo ^<Hidden^>false^</Hidden^>
  394. echo ^<RunOnlyIfIdle^>false^</RunOnlyIfIdle^>
  395. echo ^<WakeToRun^>false^</WakeToRun^>
  396. echo ^<ExecutionTimeLimit^>PT72H^</ExecutionTimeLimit^>
  397. echo ^<Priority^>7^</Priority^>
  398. echo ^</Settings^>
  399. echo ^<Actions Context="Author"^>
  400. echo ^<Exec^>
  401. echo ^<Command^>"%~dp0WDU.cmd"^</Command^>
  402. echo ^</Exec^>
  403. echo ^</Actions^>
  404. echo ^</Task^>
  405. ) >"%~dp0%Task_Name%.xml"
  406. rem
  407. rem Creating Windows Defender Update auto renewal task
  408. rem
  409. schtasks /delete /tn "%Task_Name%" /f 1>nul 2>nul
  410. schtasks /query /fo list 2>nul | findstr /i "%Task_Name%" 1>nul || (
  411. echo.&echo Creating Windows Defender Update task %Task_Name%.
  412. schtasks /create /tn "%Task_Name%" /ru "SYSTEM" /xml "%~dp0%Task_Name%.xml" >nul 2>&1 || (
  413. echo.&echo Creating Windows Defender Update %Task_Name% task errored.& echo Press any key to exit... & pause > nul &exit)
  414. rem echo Windows Defender Update task %Task_Name% created.
  415. del /f /q "%~dp0%Task_Name%.xml" >nul 2>&1)
  416. exit /b
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement