Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- mode con cols=89 lines=34
- Title WUMT Wrapper Script 2.5.3
- Color 1F & goto start
- Original script by pf100 @ MDL with special thanks to rpo and abbodi1406 @ MDL for code improvements.
- Project page and source code:
- https://forums.mydigitallife.net/threads/72203-WUMT-Wrapper-script-controls-windows-update-service
- ******************************************************************
- You may freely modify this script as you wish, I only request that you leave the credits and the
- link to the original script.
- ******************************************************************
- Don't move this script to another folder without running it again or the tasks won't work!
- Script supports only English and other Western European language characters in path.
- See https://msdn.microsoft.com/en-us/library/cc195054.aspx for more information about allowed characters.
- This script provides manual updating for Windows 10 including Home versions.
- Update Windows 10 on your schedule, not Microsoft's!
- I originally wrote this script for personal use because of the lack of update options with the
- original RTM release of Windows 10 Pro. I wanted to update Windows 10 when I had the free time
- to manually update, just like I did with previous versions of Windows that allowed me to
- set updates to manual, not when Microsoft forced it on me while I was busy using my computer.
- *******************************************************************
- WUMT is available here: https://forums.mydigitallife.net/threads/64939-Windows-Update-MiniTool
- Windows Update Blocker is available here: http://sordum.org/files/windows-update-blocker/old/Wub_v1.0.zip
- Only use Windows Update Blocker v1.0 with this script, NOT v1.1!
- *******************************************************************
- How it works: The script first checks if the OS is Windows 8.1 or older and if so
- it notifies the user, then exits. Windows 10 only!
- This script creates a smart Windows Defender Update task "WDU" that updates Windows
- Defender every 2 hours if it's running and enabled, and doesn't update it if it's not
- running and disabled, saving resources; auto-elevates, uninstalls and removes the
- Windows 10 Update Assistant, disables everything in the %programfiles%\rempl folder, resets and
- removes permissions from and disables these Update Hijackers:
- remsh.exe
- osrss.dll
- UsoClient.exe
- WaaSMedic.exe
- WaasMedicSvc.dll
- WaaSMedicPS.dll
- WaaSAssessment.dll
- MusNotification.exe
- MusNotificationUx.exe
- SIHClient.exe
- disables all WindowsUpdate tasks except for "Automatic App Update" task which can only run
- if the windows update service is enabled with the Configurator.
- makes sure the task "wub_task" is installed that runs wub at boot (to stop updates from turning
- updates back on), runs wub.exe and enables and starts the windows update service (wuauserv) if
- disabled, installs "WDU" Windows Defender Update task that runs every 2 hours (but doesn't update
- Defender if Defender is disabled), 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), then disables and
- stops wuauserv giving you full control. No more forced automatic updates or surprise reboots.
- This was written for Windows 10 Pro and Home, but works with all versions of Windows 10. Don't
- change any settings in lower left of WUMT while running the script.
- *******************************************************************
- I also included an uninstaller.cmd that deletes the "WDU" and "wub_task" tasks, deletes the WDU.cmd
- file used by WDU task, restores the rempl folder, resets Update Hijacker permissions to how they
- were originally, renables "WindowsUpdate" tasks, and turns off wub (if enabled) which turns the windows update service on automatic
- again, undoing everything done by the script. If you uninstall after having used the installer the
- script files are removed also.
- *******************************************************************
- Configurator leaves the Update Hijackers disabled, but gives you the option of turning on the windows
- update service temporarily to use the Store or any other operation that requires the windows update
- service, such as some DISM operations, installing dotNet 3.5, App Updates, etc.
- *******************************************************************
- :start
- cd /d "%~dp0"
- :::::::::::::::::::::::::::::::::::::::::
- :: Automatically check & get admin rights
- :::::::::::::::::::::::::::::::::::::::::
- :: ECHO.
- :: ECHO =============================
- :: ECHO Running Admin shell
- :: ECHO =============================
- :: Check Privileges
- :: Get Privileges
- :: and
- :: Invoke UAC for Privilege Escalation
- :: Notify if error escalating
- :: and prevent looping if escalation fails
- ::::::::::::::::::::::::::::
- set "params=Problem_with_elevating_UAC_for_Administrator_Privileges"&if exist "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs"
- fsutil dirty query %systemdrive% >nul 2>&1 && goto :GotPrivileges
- :: The following test is to avoid infinite looping if elevating UAC for Administrator Privileges failed
- 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)
- cmd /u /c echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "%~0", "%params%", "", "runas", 1 > "%temp%\getadmin.vbs"&cscript //nologo "%temp%\getadmin.vbs"&exit
- :GotPrivileges
- ::::::::::::::::::::::::::::
- ::Uninstall and remove Windows 10 Update assistant.
- ::Disable Windows Update Service until script menu screen.
- ::Reset (in case of wrong Permissions), remove Permissions from and
- ::disable "Update Hijackers"
- ::Install wub_task (prevents Windows Update service from starting after installing updates and rebooting).
- ::Install "WDU" task that only updates Defender if it's enabled. Otherwise it doesn't do anything.
- ::Enable and start the Windows Update Service (wuauserv).
- ::Run the correct version of WUMT for your architecture.
- ::Start WUMT in "auto-check for updates" mode.
- ::After updates are completed and WUMT is closed and/or the "reboot"
- ::button in WUMT is pressed, silently run wub.exe and disable and stop wuauserv
- ::::::::::::::::::::::::::::
- @echo off
- cls
- ::Test for Windows versions below Windows 10 and if so inform user, then exit...
- ::Get Windows OS build number
- for /f "tokens=2 delims==" %%a in ('wmic path Win32_OperatingSystem get BuildNumber /value') do (
- set /a WinBuild=%%a
- )
- if %winbuild% LEQ 9600 (
- cls
- echo.&echo This is not Windows 10. Press a key to exit...
- pause > nul
- exit
- )
- ::Remove Update Assistant
- if exist "%systemdrive%\Windows10Upgrade\Windows10UpgraderApp.exe" ( echo Windows 10 Update Assistant detected. Preparing to uninstall.
- echo The "Windows 10 Update Assistant has stopped working" dialog box may pop up. If so, just close it.
- echo Press a key to acknowledge this and please wait for the uninstall to finish.
- echo Script will continue after uninstall and removal is completed...
- pause > nul
- echo Uninstalling Windows 10 Update Assistant...
- %systemdrive%\Windows10Upgrade\Windows10UpgraderApp.exe /forceuninstall
- timeout /t 10 /nobreak)
- del %SystemDrive%\Windows10Upgrade\*.* /f /q >nul 2>&1
- rmdir %SystemDrive%\Windows10Upgrade /s /q >nul 2>&1
- del %systemroot%\UpdateAssistant\*.* /f /q >nul 2>&1
- rmdir %systemroot%\UpdateAssistant /s /q >nul 2>&1
- del %systemroot%\UpdateAssistantV2\*.* /f /q >nul 2>&1
- rmdir %systemroot%\UpdateAssistantV2 /s /q >nul 2>&1
- ::::::::::::::::::::::::::::
- echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.
- echo. & echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ Initializing script...
- ::::::::::::::::::::::::::::
- ::In case new script is copied over old script while wub.exe-backup exists, then wub.exe would exist too,
- ::so check if windows update service is disabled or not and then correctly delete either wub.exe or wub.exe-backup.
- Reg query "HKLM\SYSTEM\CurrentControlSet\Services\wuauserv" /v "Start" | find "4" >nul 2>&1
- if %errorlevel% == 0 (if exist wub.exe del wub.exe-backup /f /q >nul 2>&1) else (if exist wub.exe-backup del wub.exe /f /q >nul 2>&1)
- if exist wub.exe-backup ren wub.exe-backup wub.exe
- ::::::::::::::::::::::::::::
- :: Disable all Windows Update tasks.
- takeown /f "%systemroot%\System32\Tasks\Microsoft\Windows\WindowsUpdate\*" /a >nul 2>&1
- icacls "%systemroot%\System32\Tasks\Microsoft\Windows\WindowsUpdate\*" /q /c /t /reset >nul 2>&1
- for %%? in ("%systemroot%\System32\Tasks\Microsoft\Windows\WindowsUpdate\*") do schtasks /change /tn "Microsoft\Windows\WindowsUpdate\%%~nx?" /disable >nul 2>&1
- 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
- ::::::::::::::::::::::::::::
- ::Set list (s32list) of update hijacker files to be disabled, then disable everything in the list.
- set s32list=EOSNotify.exe WaaSMedic.exe WaasMedicSvc.dll WaaSMedicPS.dll WaaSAssessment.dll UsoClient.exe
- set s32list=%s32list% SIHClient.exe MusNotificationUx.exe MusNotification.exe osrss.dll
- set s32=%systemroot%\System32
- for %%# in (%s32list%) do (
- takeown /f "%s32%\%%#" /a >nul 2>&1
- icacls "%s32%\%%#" /reset >nul 2>&1
- icacls "%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
- )
- ::If files in "s32list" aren't locked for whatever reason, rename them.
- for %%# in (%s32list%) do (
- ren "%s32%\%%#" "%%#"-backup >nul 2>&1
- if exist "%s32%\%%#"-backup del "%s32%\%%#" /f /q >nul 2>&1
- )
- ::::::::::::::::::::::::::::
- ::Disable rempl
- for %%? in ("%ProgramFiles%\rempl\*") do (
- takeown /f "%%?" /a >nul 2>&1
- icacls "%%?" /reset >nul 2>&1
- icacls "%%?" /inheritance:r /remove *S-1-5-32-544 *S-1-5-11 *S-1-5-32-545 *S-1-5-18 >nul 2>&1
- )
- ::::::::::::::::::::::::::::
- cls
- echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.
- echo. & echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ Initializing script...
- echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ Creating Tasks...
- ::::::::::::::::::::::::::::
- :: Create WDU.cmd
- (
- echo SETLOCAL EnableDelayedExpansion
- echo ::Allow only WDU task to run this file::
- echo whoami /user /nh ^| find /i "S-1-5-18" ^|^| exit
- echo cd /d "%%~dp0"
- echo ::Wait 5 minutes to prevent resource hogging after reboot with missed update::
- echo timeout /t 300
- echo ::If WUMT or WuMgr are running, cancel Defender update and exit. If not, continue::
- echo tasklist ^| findstr /irc:"wumt_x.*exe"
- echo if %%errorlevel%% equ 0 goto skipdefenderupdate
- echo tasklist ^| findstr "wumgr.exe"
- echo if %%errorlevel%% equ 0 goto skipdefenderupdate
- echo ::If Windows Defender is running, update it. If not, cancel Defender update and exit::
- echo sc query ^| find /i "windefend"
- echo if %%errorlevel%% equ 1 goto skipdefenderupdate
- echo ::Enable Windows Update service and update Defender, then disable Update Service::
- echo if not exist wub.exe-backup ^(wub.exe /e^)
- echo timeout /t 10
- echo "%%ProgramFiles%%\Windows Defender\MpCmdRun.exe" -SignatureUpdate
- echo if not exist wub.exe-backup ^(wub.exe /d /p^)
- echo goto defenderupdated
- echo :skipdefenderupdate
- echo set errorlevel=1
- echo :defenderupdated
- echo exit /b %%errorlevel%%
- )>wdu.cmd"
- ::::::::::::::::::::::::::::
- ::Create WDU task, and wub_task
- call :createwdu
- call :createwub_task
- ::::::::::::::::::::::::::::
- cls
- echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.
- echo. & echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ Initializing script...
- echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ Creating Tasks...
- echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ Disabling update service...
- ::::::::::::::::::::::::::::
- ::Disable update service.
- wub.exe /d /p >nul 2>&1
- timeout /t 2 >nul 2>&1
- ::::::::::::::::::::::::::::
- :splash
- cls
- echo.
- echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ::::::::::::::::::::::::::::::::
- echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ : ^ Welcome to manual updates! ^ :
- echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ::::::::::::::::::::::::::::::::
- echo.
- echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ [44;93mThe Windows Update Service is now DISABLED and stopped.[44;97m
- echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ [44;93mThe tasks "WDU" and "wub_task" have been (re)created.[44;97m
- echo.
- echo ^ * ^ After an update, re-run the script and just close this screen to make sure the
- echo "Update Hijackers" stay off. You may close this screen now by clicking "X" in window.
- echo.
- echo ^ * ^ Automatic updates and "update hijackers" are now turned off. This script controls
- echo the update process. It automatically disables a range of "Update Hijackers" (see readme).
- echo.
- echo ^ * ^ If you choose to review any available Windows updates, it enables and starts only
- echo the Windows Update Service, then runs the Windows Update MiniTool (WUMT) to find and
- echo then hide or install selected Windows updates. Don't change WUMT settings while running
- echo this script. If WUMT is offering updates, you need to hide or install them before
- echo closing WUMT or it may install them later without asking next time.
- echo.
- echo ^ * ^ After checking for updates, the script stops and disables the Windows Update service
- echo when WUMT is closed regardless of whether the service was previously enabled.
- echo.
- echo ^ * ^ If you choose to use the Store, you can enable update service in Configurator.
- echo After using the Store, then either 1) disable update service or 2) continue script to
- echo check for Windows updates with WUMT after which the update service will be disabled.
- echo.
- echo ^ * ^ If you move this script to another folder run it again so the tasks will work!
- echo.
- echo ^ * ^ The included uninstaller undoes script changes.
- echo.&echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ [44;93m---^>^>^> Press any key to continue. ^<^<^<---[44;97m
- pause > nul
- ::::::::::::::::::::::::::::
- ::Windows Update Service Configurator
- cls
- echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.
- echo. & echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ Initializing Configurator...
- ::disable windows update service except when wumt is run.
- :wudisable
- wub.exe /d /p >nul 2>&1
- timeout /t 2 /nobreak >nul 2>&1
- cls
- echo.&echo.
- echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ :^ WUMT Wrapper Script Windows Update Service Configurator^ :
- echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: &echo.&echo.
- echo.&echo.&echo ^ ^ ^ ^ ^ ^ ^ ^ ^ [44;93m---^>^>^> Windows Update Service is DISABLED and stopped ^(default^) ^<^<^<---[44;97m
- echo.&echo.&echo.&echo.&echo [[44;93mE[44;97m]nable Update Service temporarily to use Windows Store.
- echo.& echo [[44;93mC[44;97m]ontinue script to run WUMT and check for Windows Updates.
- echo.& echo [[44;93mQ[44;97m]uit script, or "Alt + F4", or close window, if you're just verifying or are
- echo ^ ^ ^ finished changing the update service setting. It stays how it's set above.
- echo.&echo.&echo.&echo.&echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ Please select [[44;93mE[44;97m], [[44;93mC[44;97m], or [[44;93mQ[44;97m] (or close window)
- echo.&echo.&echo.&echo.&echo.&echo.&echo.
- CHOICE /C ECQ /M "Your choice?:" >nul 2>&1
- if %errorlevel%==3 (exit)
- if %errorlevel%==2 (goto StartWUMT)
- cls
- echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.
- echo.&echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ Please wait while Windows Update Service is enabled...
- ::enable windows update service
- :wuenable
- wub.exe /e >nul 2>&1
- timeout /t 2 /nobreak >nul 2>&1
- cls
- echo.&echo.&echo.
- echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ :^ WUMT Wrapper Script Windows Update Service Configurator^ :
- echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: &echo.&echo.&echo.
- echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ [44;93m---^>^>^> Windows Update Service is ENABLED ^(for Store^) ^<^<^<---[44;97m
- echo.&echo.&echo.&echo [[44;93mD[44;97m]isable Update Service and only allow to run during script updates (default).
- echo.&echo [[44;93mC[44;97m]ontinue script to run WUMT and check for Windows Updates. Update service will
- echo ^ ^ ^ ^ ^ ^ be disabled automatically after update check and WUMT is closed.
- echo.&echo.&echo.&echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ Please select [[44;93mD[44;97m] or [[44;93mC[44;97m]
- echo.&echo.&echo.&echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ [44;93m:^ Don't close this window or update service will stay on!!!^ :[44;97m
- echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ [44;93m: ^ ^ Don't worry. Just run the script again to turn it off ^ ^ :[44;97m
- echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- echo.&echo.&echo.&echo.
- CHOICE /C DC /M "Your choice?:" >nul 2>&1
- if %errorlevel%==2 (goto StartWUMT)
- if %errorlevel%==1 (
- cls
- echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.
- echo.&echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ Please wait while Windows Update Service is disabled...
- goto wudisable
- )
- ::::::::::::::::::::::::::::
- :createwdu
- :: Create automatic Windows Defender Update "WDU" task that updates Defender only if it's enabled and running.
- set "Task_Name=WDU"
- :: Create WDU.xml
- ::
- set "w=echo f.writeline "
- (
- echo Set Fso=CreateObject^("Scripting.FileSystemObject"^):Set f=Fso.CreateTextFile^(fso.GetSpecialFolder^(2^) ^& "\task.xml",True^)
- %w%"<?xml version=""1.0"" encoding=""UTF-16""?>"
- %w%"<Task version=""1.2"" xmlns=""http://schemas.microsoft.com/windows/2004/02/mit/task"">"
- %w%"<RegistrationInfo>"
- %w%"<Date>2016-02-18T08:29:39</Date>"
- %w%"<Author>pf100\rpo</Author>"
- %w%"<URI>\WDU</URI>"
- %w%"</RegistrationInfo>"
- %w%"<Triggers>"
- %w%"<CalendarTrigger>"
- %w%"<Repetition>"
- %w%"<Interval>PT6H</Interval>"
- %w%"<StopAtDurationEnd>false</StopAtDurationEnd>"
- %w%"</Repetition>"
- %w%"<StartBoundary>2016-05-12T00:01:00.0</StartBoundary>"
- %w%"<Enabled>true</Enabled>"
- %w%"<ScheduleByDay>"
- %w%"<DaysInterval>1</DaysInterval>"
- %w%"</ScheduleByDay>"
- %w%"</CalendarTrigger>"
- %w%"</Triggers>"
- %w%"<Principals>"
- %w%"<Principal id=""Author"">"
- %w%"<RunLevel>HighestAvailable</RunLevel>"
- %w%"</Principal>"
- %w%"</Principals>"
- %w%"<Settings>"
- %w%"<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>"
- %w%"<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>"
- %w%"<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>"
- %w%"<AllowHardTerminate>true</AllowHardTerminate>"
- %w%"<StartWhenAvailable>true</StartWhenAvailable>"
- %w%"<RunOnlyIfNetworkAvailable>true</RunOnlyIfNetworkAvailable>"
- %w%"<IdleSettings>"
- %w%"<StopOnIdleEnd>false</StopOnIdleEnd>"
- %w%"<RestartOnIdle>false</RestartOnIdle>"
- %w%"</IdleSettings>"
- %w%"<AllowStartOnDemand>true</AllowStartOnDemand>"
- %w%"<Enabled>true</Enabled>"
- %w%"<Hidden>false</Hidden>"
- %w%"<RunOnlyIfIdle>false</RunOnlyIfIdle>"
- %w%"<WakeToRun>false</WakeToRun>"
- %w%"<ExecutionTimeLimit>PT72H</ExecutionTimeLimit>"
- %w%"<Priority>7</Priority>"
- %w%"</Settings>"
- %w%"<Actions Context=""Author"">"
- %w%"<Exec>"
- %w%"<Command>""" ^& FSO.GetParentFolderName^(Wscript.ScriptFullName^) ^& "\%Task_Name%.cmd" ^& """</Command>"
- %w%"</Exec>"
- %w%"</Actions>"
- %w%"</Task>"
- echo f.Close
- )>"%~dp0task.vbs" &"%~dp0task.vbs" & del "%~dp0task.vbs"
- ::
- :: Creating Windows Defender Update auto renewal task
- ::
- schtasks /delete /tn "%Task_Name%" /f >nul 2>&1
- schtasks /query /tn "%Task_Name%" >nul 2>&1 || (
- schtasks /create /tn "%Task_Name%" /ru "SYSTEM" /xml "%temp%\task.xml" >nul 2>&1) || (
- cls&echo.&echo Creating Windows Defender Update Auto-Renewal %Task_Name% task errored.&echo.&echo %~dp0 is invalid path name.&echo.&echo English and other Western European language characters allowed only.&echo.&echo Move wrapper script folder to suitable path and run again.&echo.&echo See https://msdn.microsoft.com/en-us/library/cc195054.aspx for more information.&echo.&echo Press any key to exit... & pause > nul &exit)
- del "%temp%\task.xml" >nul 2>&1)
- exit /b
- ::::::::::::::::::::::::::::
- :createwub_task
- ::
- :: Create Windows Update Blocker "Wub_task" that sets your desired Windows Update service state at boot.
- ::
- :: Create Wub_task
- ::
- set "Task_Name=Wub_task"
- set "w=echo f.writeline "
- (
- echo Set Fso=CreateObject^("Scripting.FileSystemObject"^):Set f=Fso.CreateTextFile^(fso.GetSpecialFolder^(2^) ^& "\task.xml",True^)
- %w%"<?xml version=""1.0"" encoding=""UTF-16""?>"
- %w%"<Task version=""1.2"" xmlns=""http://schemas.microsoft.com/windows/2004/02/mit/task"">"
- %w%"<RegistrationInfo>"
- %w%"<Date>2016-02-18T08:29:39</Date>"
- %w%"<Author>pf100\rpo</Author>"
- %w%"<URI>\wub_task</URI>"
- %w%"</RegistrationInfo>"
- %w%"<Triggers>"
- %w%"<BootTrigger>"
- %w%"<StartBoundary>2016-02-18T08:29:00</StartBoundary>"
- %w%"<Enabled>true</Enabled>"
- %w%"</BootTrigger>"
- %w%"<LogonTrigger>"
- %w%"<Enabled>true</Enabled>"
- %w%"</LogonTrigger>"
- %w%"</Triggers>"
- %w%"<Principals>"
- %w%"<Principal id=""Author"">"
- %w%"<RunLevel>HighestAvailable</RunLevel>"
- %w%"</Principal>"
- %w%"</Principals>"
- %w%"<Settings>"
- %w%"<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>"
- %w%"<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>"
- %w%"<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>"
- %w%"<AllowHardTerminate>true</AllowHardTerminate>"
- %w%"<StartWhenAvailable>true</StartWhenAvailable>"
- %w%"<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>"
- %w%"<IdleSettings>"
- %w%"<StopOnIdleEnd>false</StopOnIdleEnd>"
- %w%"<RestartOnIdle>false</RestartOnIdle>"
- %w%"</IdleSettings>"
- %w%"<AllowStartOnDemand>true</AllowStartOnDemand>"
- %w%"<Enabled>true</Enabled>"
- %w%"<Hidden>false</Hidden>"
- %w%"<RunOnlyIfIdle>false</RunOnlyIfIdle>"
- %w%"<WakeToRun>false</WakeToRun>"
- %w%"<ExecutionTimeLimit>PT72H</ExecutionTimeLimit>"
- %w%"<Priority>7</Priority>"
- %w%"</Settings>"
- %w%"<Actions Context=""Author"">"
- %w%"<Exec>"
- %w%"<Command>""" ^& FSO.GetParentFolderName^(Wscript.ScriptFullName^) ^& "\Wub.exe""</Command>"
- %w%"<Arguments>/d /p</Arguments>"
- %w%"</Exec>"
- %w%"</Actions>"
- %w%"</Task>"
- echo f.Close
- )>"%~dp0task.vbs" & "%~dp0task.vbs" & del "%~dp0task.vbs"
- ::
- :: Creating Windows Update Blocker auto renewal task
- ::
- schtasks /delete /tn "%Task_Name%" /f >nul 2>&1
- schtasks /query /tn "%Task_Name%" >nul 2>&1 || (
- schtasks /create /tn "%Task_Name%" /ru "SYSTEM" /xml "%temp%\task.xml" >nul 2>&1) || (
- cls&echo.&echo Creating Windows Update Blocker Auto-Renewal %Task_Name% task errored.&echo.&echo %~dp0 is invalid path name.&echo.&echo English and other Western European language characters allowed only.&echo.&echo Move wrapper script folder to suitable path and run again.&echo.&echo See https://msdn.microsoft.com/en-us/library/cc195054.aspx for more information.&echo.&echo Press any key to exit... & pause > nul &exit)
- del "%temp%\task.xml" >nul 2>&1)
- exit /b
- ::::::::::::::::::::::::::::
- :StartWUMT
- cls
- (
- echo cd /d "%%~dp0"
- echo if exist wub.exe-backup ren wub.exe-backup wub.exe
- echo wub.exe /d /p
- echo del close.cmd ^& exit
- )>close.cmd
- wub.exe /e >nul 2>&1
- :: Check OS and run correct version of WUMT
- wmic cpu get AddressWidth /value|find "32">nul&&set wumt=wumt_x86.exe||set wumt=wumt_x64.exe
- Start "" "%wumt%" -update "-onclose close.cmd"
- ::If you want to use WuMgr instead of WUMT, insert rem (space) at beginning of WUMT line above, and un-rem the wumgr.exe line below.
- rem Start "" wumgr.exe -update -online 7971f918-a847-4430-9279-4a52d1efe18d -onclose close.cmd
- exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement