Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Script:
- @echo off & goto start
- WUMT Wrapper Script version 2.2.8
- Original script by pf100 @ MDL with special thanks to rpo and abbodi1406 @ MDL for code improvements.
- 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.
- ******************************************************************
- This script provides manual updates.
- 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.
- When my computer rebooted in the middle of the night after a forced update I swore it would be
- the last time I would let that happen. With the Windows 10 Anniversary Edition, increased lack
- of control and arbitrary removal of registry options only got worse. Microsoft removed previously
- working Group Policies and registry tweaks on Windows 10 Pro and Windows 10 Home and I expect
- things may only get worse with future major updates. The methods that may or may not work now
- such as update notifications, metered network connections, Windows 10 Pro Group Policy edits,
- and other workarounds implemented to control automatic updates are not guaranteed to work forever
- on Windows 10 if the past is any indicator. This script will always allow fully
- manual updates no matter what Microsoft does to force automatic updates, including Windows 10 Home.
- *******************************************************************
- Installation: Save this script, the Windows Update MiniTool (WUMT), and Windows Update Blocker in the same folder, i.e.
- "X:\Windows Update", then make a shortcut to this script and use it to run windows updates
- manually from now on. You only have to make the shortcut run as administrator if you have an elevation problem since it auto-elevates.
- WUMT is available here: https://forums.mydigitallife.net/threads/64939-Windows-Update-MiniTool
- *It is recommended to keep the Windows Update Minitool (WUMT) updated to the latest version.*
- Windows Update Blocker is available here: http://www.sordum.org/9470/windows-update-blocker-v1-0/
- *******************************************************************
- 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,
- 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,
- 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 in the middle of the night. This was
- written for Windows 10 Pro and Home, but works with all versions of Windows 10.
- *******************************************************************
- *If you need to install .Net 3.5 or use the Windows 10 Store or something that needs wuauserv
- running, run the script and after it enables wuauserv and starts WUMT, install what you need
- after WUMT checks for updates, before closing WUMT. If you ran the Configurator to "leave
- the Windows Update Service running at all times" you can ignore this note as the store will
- work at any time and Windows Defender will get updates.
- *******************************************************************
- :start
- :::::::::::::::::::::::::::::::::::::::::
- :: Automatically check & get admin rights
- :::::::::::::::::::::::::::::::::::::::::
- Title WUMT Wrapper Script 2.2.8
- Color 1F
- CLS
- :: 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
- ::::::::::::::::::::::::::::
- ::START
- ::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 UsoClient.exe,
- ::WaaSMedic.exe, WaasMedicSvc.dll, WaaSMedicPS.dll, WaaSAssessment.dll, and SIHClient.exe.
- ::Kill remsh.exe if it's running.
- ::Rename the folder %ProgramFiles%\rempl to %ProgramFiles%\rempl-backup if it exists.
- ::Install wub_task (prevents Windows Update service from starting after installing updates and rebooting).
- ::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.
- echo Please wait...
- ::::::::::::::::::::::::::::
- @echo off
- cls
- if exist "%systemdrive%\Windows10Upgrade\Windows10UpgraderApp.exe" ( echo Windows 10 Update Assistant detected. Preparing to uninstall. ) else ( goto noevil )
- 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 15 seconds 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 15 /nobreak >nul 2>&1
- del %systemroot%\UpdateAssistant\*.* /f /q >nul 2>&1
- rmdir %systemroot%\UpdateAssistant /s /q >nul 2>&1
- del %SystemDrive%\Windows10Upgrade\*.* /f /q >nul 2>&1
- rmdir %SystemDrive%\Windows10Upgrade /s /q >nul 2>&1
- cls
- echo Windows 10 Update Assistant removed.
- echo Press a key to continue...
- pause > nul
- :noevil
- del %systemroot%\UpdateAssistantV2\*.* /f /q >nul 2>&1
- rmdir %systemroot%\UpdateAssistantV2 /s /q >nul 2>&1
- ::::::::::::::::::::::::::::
- "%~dp0wub.exe" /d /p >nul 2>&1
- ::::::::::::::::::::::::::::
- takeown /f "%systemroot%\System32\UsoClient.exe" /a >nul 2>&1
- icacls "%systemroot%\System32\UsoClient.exe" /reset >nul 2>&1
- 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
- ::::::::::::::::::::::::::::
- takeown /f "%systemroot%\System32\WaaSMedic.exe" /a >nul 2>&1
- icacls "%systemroot%\System32\WaaSMedic.exe" /reset >nul 2>&1
- 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
- ::::::::::::::::::::::::::::
- takeown /f "%systemroot%\System32\WaasMedicSvc.dll" /a >nul 2>&1
- icacls "%systemroot%\System32\WaasMedicSvc.dll" /reset >nul 2>&1
- 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
- ::::::::::::::::::::::::::::
- takeown /f "%systemroot%\System32\WaaSMedicPS.dll" /a >nul 2>&1
- icacls "%systemroot%\System32\WaaSMedicPS.dll" /reset >nul 2>&1
- 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
- ::::::::::::::::::::::::::::
- takeown /f "%systemroot%\System32\WaaSAssessment.dll" /a >nul 2>&1
- icacls "%systemroot%\System32\WaaSAssessment.dll" /reset >nul 2>&1
- 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
- ::::::::::::::::::::::::::::
- takeown /f "%systemroot%\System32\SIHClient.exe" /a >nul 2>&1
- icacls "%systemroot%\System32\SIHClient.exe" /reset >nul 2>&1
- 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
- ::::::::::::::::::::::::::::
- taskkill /im remsh.exe /f >nul 2>&1
- if exist "%ProgramFiles%\rempl" rmdir /s /q "%ProgramFiles%\rempl-backup" >nul 2>&1
- ren "%ProgramFiles%\rempl" rempl-backup >nul 2>&1
- ::::::::::::::::::::::::::::
- set "Task_Name=wub_task"
- schtasks /delete /tn "%Task_Name%" /f 1>nul 2>nul
- schtasks /query /tn "%Task_Name%" >nul 2>&1 || (
- echo.&echo Creating Windows Update Blocker Auto-Renewal task %Task_Name%.
- (echo ^<?xml version="1.0" encoding="UTF-16"?^>
- echo ^<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task"^>
- echo ^<RegistrationInfo^>
- echo ^<Date^>2018-02-18T08:29:39^</Date^>
- echo ^<Author^>pf100\rpo^</Author^>
- echo ^<URI^>\wub_task^</URI^>
- echo ^</RegistrationInfo^>
- echo ^<Triggers^>
- echo ^<BootTrigger^>
- echo ^<StartBoundary^>2018-02-18T08:29:00^</StartBoundary^>
- echo ^<Enabled^>true^</Enabled^>
- echo ^</BootTrigger^>
- echo ^</Triggers^>
- echo ^<Principals^>
- echo ^<Principal id="Author"^>
- echo ^<RunLevel^>HighestAvailable^</RunLevel^>
- echo ^</Principal^>
- echo ^</Principals^>
- echo ^<Settings^>
- echo ^<MultipleInstancesPolicy^>IgnoreNew^</MultipleInstancesPolicy^>
- echo ^<DisallowStartIfOnBatteries^>false^</DisallowStartIfOnBatteries^>
- echo ^<StopIfGoingOnBatteries^>false^</StopIfGoingOnBatteries^>
- echo ^<AllowHardTerminate^>true^</AllowHardTerminate^>
- echo ^<StartWhenAvailable^>false^</StartWhenAvailable^>
- echo ^<RunOnlyIfNetworkAvailable^>false^</RunOnlyIfNetworkAvailable^>
- echo ^<IdleSettings^>
- echo ^<StopOnIdleEnd^>true^</StopOnIdleEnd^>
- echo ^<RestartOnIdle^>false^</RestartOnIdle^>
- echo ^</IdleSettings^>
- echo ^<AllowStartOnDemand^>true^</AllowStartOnDemand^>
- echo ^<Enabled^>true^</Enabled^>
- echo ^<Hidden^>false^</Hidden^>
- echo ^<RunOnlyIfIdle^>false^</RunOnlyIfIdle^>
- echo ^<WakeToRun^>false^</WakeToRun^>
- echo ^<ExecutionTimeLimit^>PT72H^</ExecutionTimeLimit^>
- echo ^<Priority^>7^</Priority^>
- echo ^</Settings^>
- echo ^<Actions Context="Author"^>
- echo ^<Exec^>
- echo ^<Command^>"%~dp0wub.exe"^</Command^>
- echo ^<Arguments^>/d /p^</Arguments^>
- echo ^</Exec^>
- echo ^</Actions^>
- echo ^</Task^>) >"%~dp0%Task_Name%.xml"
- schtasks /create /tn "%Task_Name%" /ru "SYSTEM" /xml "%~dp0%Task_Name%.xml" >nul 2>&1)
- ::::::::::::::::::::::::::::
- cls
- echo ***********************************************
- echo Welcome to manual updates!
- echo Automatic updates are now turned off
- echo (unless overriden with Configurator).
- echo This script automates the update process
- echo It automatically disables a range of useless junk
- echo that bypasses windows update, such as:
- echo remsh, UsoClient, WaaSMedic, SIHClient, and Update Assistant.*
- echo Enables and starts only the Windows Update Service.
- echo Runs the Windows Update MiniTool (WUMT).
- echo After updates, stops and disables the Windows Update service.
- echo *The included uninstaller undoes script changes.*
- echo Closing WUMT at any time disables updates again;
- echo however, if WUMT is already offering updates, you
- echo need to hide them and/or install them one-by-one
- echo before closing WUMT or it may install them without
- echo asking next time. Don't change WUMT settings while
- echo running this script. If an update requires a reboot,
- echo re-run the script and just close the first screen
- echo to make sure the useless junk that forces updates
- echo stay off.
- echo Run Configurator.cmd to enable running store and defender
- echo ***********************************************
- echo. & echo Press any key to check for updates, or
- echo close this screen to cancel and leave updates turned off
- echo (unless overridden with configurator) & pause > nul
- "%~dp0wub.exe" /e
- :: Check OS and run correct version of WUMT
- for /f "tokens=2 delims==" %%a in ('wmic cpu get AddressWidth /value') do (set arch=%%a)
- IF %arch% == 32 (set "wumt=%~dp0wumt_x86.exe") else (set "wumt=%~dp0wumt_x64.exe")
- Start "" "%wumt%" -update "-onclose %~dp0wub.exe /d /p"
- --------------------------------------------------------------------------------------------------------------------------------------
- --------------------------------------------------------------------------------------------------------------------------------------
- Configurator:
- @echo off
- Color 1F
- Title WUMT Wrapper Script Configurator 2.2.8
- ::::::::::::::::::::::::::::
- 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
- ::::::::::::::::::::::::::::
- echo Welcome to WUMT Wrapper Script Configurator
- echo [D]isable Update Service and only allow to run during manual updates (default)
- echo.
- echo [K]eep the Update Service always running to allow Defender Updates and Store at any time
- echo.
- CHOICE /C DK /M "YOUR CHOICE ?:"
- if %errorlevel%==2 goto enablewub
- if %errorlevel%==1 goto disablewub
- :enablewub
- "%~dp0wub.exe" /e >nul 2>&1
- ren "%~dp0wub.exe" wub.exe-backup >nul 2>&1
- cls
- echo Windows Update Service now enabled and running and it won't be manipulated by wrapper script.
- echo To reverse changes just run script again.
- echo Press any key to exit...
- pause > nul
- goto end
- :disablewub
- ren "%~dp0wub.exe-backup" wub.exe >nul 2>&1
- "%~dp0wub.exe" /d /p >nul 2>&1
- cls
- echo Windows Update Service disabled except for manual update checks with script.
- echo To reverse changes just run script again.
- echo Press any key to exit...
- pause > nul
- :end
- -------------------------------------------------------------------------------------------------------------------------------------
- -------------------------------------------------------------------------------------------------------------------------------------
- Uninstaller:
- @echo off
- Color 1F
- Title WUMT Wrapper Script 2.2.8 uninstaller
- 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
- echo Press a key to uninstall WUMT Wrapper Script
- echo or close window or ctrl-c to cancel.
- pause > nul
- @echo on
- ren "%ProgramFiles%\rempl-backup" rempl
- ren "%~dp0wub.exe-backup" wub.exe
- schtasks /delete /tn "wub_task" /f
- ::::::::::::::::::::::::::::::::::
- takeown /f "%systemroot%\System32\UsoClient.exe" /a
- icacls "%systemroot%\System32\UsoClient.exe" /reset
- icacls "%systemroot%\System32\UsoClient.exe" /setowner *S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464
- ::::::::::::::::::::::::::::::::::
- takeown /f "%systemroot%\System32\WaaSMedic.exe" /a
- icacls "%systemroot%\System32\WaaSMedic.exe" /reset
- icacls "%systemroot%\System32\WaaSMedic.exe" /setowner *S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464
- ::::::::::::::::::::::::::::::::::
- takeown /f "%systemroot%\System32\WaasMedicSvc.dll" /a
- icacls "%systemroot%\System32\WaasMedicSvc.dll" /reset
- icacls "%systemroot%\System32\WaasMedicSvc.dll" /setowner *S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464
- ::::::::::::::::::::::::::::::::::
- takeown /f "%systemroot%\System32\WaaSMedicPS.dll" /a
- icacls "%systemroot%\System32\WaaSMedicPS.dll" /reset
- icacls "%systemroot%\System32\WaaSMedicPS.dll" /setowner *S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464
- ::::::::::::::::::::::::::::::::::
- takeown /f "%systemroot%\System32\WaaSAssessment.dll" /a
- icacls "%systemroot%\System32\WaaSAssessment.dll" /reset
- icacls "%systemroot%\System32\WaaSAssessment.dll" /setowner *S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464
- ::::::::::::::::::::::::::::::::::
- takeown /f "%systemroot%\System32\SIHClient.exe" /a
- icacls "%systemroot%\System32\SIHClient.exe" /reset
- icacls "%systemroot%\System32\SIHClient.exe" /setowner *S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464
- ::::::::::::::::::::::::::::::::::
- "%~dp0wub.exe" /e
- @echo off
- echo ::::::::::::::::::::::::::::::::::::
- echo :WUMT Wrapper Script changes undone:
- echo ::::::::::::::::::::::::::::::::::::
- echo Press any key to exit...
- pause > nul
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement