forked from abbodi1406/ConsumerESU
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConsumer_ESU_ScheduledTasks.cmd
More file actions
73 lines (67 loc) · 2.33 KB
/
Copy pathConsumer_ESU_ScheduledTasks.cmd
File metadata and controls
73 lines (67 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
@setlocal DisableDelayedExpansion
@echo off
set "Path=%SystemRoot%\System32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SystemRoot%\System32\WindowsPowerShell\v1.0\"
if exist "%SystemRoot%\Sysnative\reg.exe" (
set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%SystemRoot%\Sysnative\WindowsPowerShell\v1.0\;%Path%"
)
set "_err===== ERROR ===="
for /f "tokens=6 delims=[]. " %%# in ('ver') do (
if %%# gtr 19045 goto :E_Win
if %%# lss 19041 goto :E_Win
)
reg query HKU\S-1-5-19 1>nul 2>nul || goto :E_Admin
set "_uKey=HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows\ConsumerESU"
set "_mKey=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\ESU"
set _uESU=0
set _mESU=0
for /f "skip=2 tokens=2*" %%a in ('reg query "%_uKey%" /v ESUEligibility 2^>nul') do call set /a _uESU=%%b
for /f "skip=2 tokens=2*" %%a in ('reg query "%_mKey%" /v Win10ConsumerESUStatus 2^>nul') do call set /a _mESU=%%b
set _enrolled=1
if %_uESU% neq 3 if %_uESU% neq 11 if %_uESU% neq 12 set _enrolled=0
if %_mESU% neq 3 if %_mESU% neq 11 if %_mESU% neq 12 set _enrolled=0
if %_enrolled% equ 1 (set "_status=Enrolled") else (set "_status=!! NOT ENROLLED !!")
:mMenu
@cls
echo ============================================================
echo Consumer ESU Status: %_status%
echo ============================================================
echo.
echo [1] Disable Consumer ESU scheduled tasks
echo.
echo [2] Enable Consumer ESU scheduled tasks
echo.
echo [3] Exit
echo.
echo ============================================================
echo.
choice /C 123 /N /M "Choose a menu option: "
set _elr=%errorlevel%
if %_elr%==3 goto :eof
if %_elr%==2 (set "_opt=/ENABLE"&goto :Tasks)
if %_elr%==1 (set "_opt=/DISABLE"&goto :Tasks)
goto :mMenu
:Tasks
@cls
set "_cmnd=schtasks.exe /Change %_opt% /TN"
set "_task=\Microsoft\Windows\Clip\ClipEsuConsumer"
echo.
%_cmnd% "%_task%" 2>nul && echo.
%_cmnd% "%_task%ProcessPreOrder" 2>nul && echo.
%_cmnd% "%_task%ProcessRefund" 2>nul && echo.
%_cmnd% "%_task%ProcessECUpdate" 2>nul && echo.
echo.
echo Done.
goto :TheEnd
:E_Admin
echo %_err%
echo This script requires administrator privileges.
goto :TheEnd
:E_Win
echo %_err%
echo This script is for Windows 10 v22H2 only.
goto :TheEnd
:TheEnd
echo.
echo Press any key to exit.
pause >nul
goto :eof