Repository navigation
Expand file tree
/
Copy pathdisableTasks.bat
More file actions
289 lines (240 loc) · 8.88 KB
/
Copy pathdisableTasks.bat
File metadata and controls
289 lines (240 loc) · 8.88 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
::
:: Disable a list of tasks you might not need to be running
::
:: vs 1.0.0
:: date 13.06.2025
::
@echo off
setlocal
set my_name=%~n0%~x0
set my_dir="%~dp0"
set "my_dir=%my_dir:~1,-2%"
set /a ACTION_DISABLE=1
set /a ACTION_ENABLE=2
set /a ACTION_CHECK=3
set /a ACTION_DELETE=4
set /a action=%ACTION_CHECK%
set /a verbose=0
set name=
set names=(^
\Microsoft\Windows\AccountHealth\RecoverabilityToastTask^
\Microsoft\Windows\CloudExperienceHost\CreateObjectTask^
\Microsoft\Windows\CloudRestore\Backup^
"\Microsoft\Windows\Customer Experience Improvement Program\Consolidator"^
"\Microsoft\Windows\Customer Experience Improvement Program\UsbCeip"^
\Microsoft\Windows\Flighting\FeatureConfig\BootstrapUsageDataReporting^
\Microsoft\Windows\Flighting\FeatureConfig\GovernedFeatureUsageProcessing^
\Microsoft\Windows\Flighting\FeatureConfig\ReconcileConfigs^
\Microsoft\Windows\Flighting\FeatureConfig\ReconcileFeatures^
\Microsoft\Windows\Flighting\FeatureConfig\UsageDataFlushing^
\Microsoft\Windows\Flighting\FeatureConfig\UsageDataReceiver^
\Microsoft\Windows\Flighting\FeatureConfig\UsageDataReporting^
\Microsoft\Windows\Flighting\OneSettings\RefreshCache^
"\Microsoft\Windows\International\Synchronize Language Settings"^
\Microsoft\Windows\Maps\MapsToastTask^
\Microsoft\Windows\Maps\MapsUpdateTask^
"\Microsoft\Windows\User Profile Service\HiveUploadTask"^
"\Microsoft\Windows\Windows Error Reporting\QueueReporting"^
\Microsoft\Windows\UsageAndQualityInsights\UsageAndQualityInsights-MaintenanceTask^
\Microsoft\Windows\WindowsAI\Recall\InitialConfiguration^
\Microsoft\Windows\WindowsAI\Recall\PolicyConfiguration^
\Microsoft\Windows\WindowsAI\Settings\InitialConfiguration^
)
if [%1]==[] goto main
GOTO :ParseParams
:ParseParams
if [%1]==[/?] goto help
if [%1]==[/h] goto help
if [%1]==[/help] goto help
IF /i "%~1"=="/c" (
SET /a action=%ACTION_CHECK%
goto reParseParams
)
IF /i "%~1"=="/check" (
SET /a action=%ACTION_CHECK%
goto reParseParams
)
IF /i "%~1"=="/d" (
SET /a action=%ACTION_DISABLE%
goto reParseParams
)
IF /i "%~1"=="/disable" (
SET /a action=%ACTION_DISABLE%
goto reParseParams
)
IF /i "%~1"=="/e" (
SET /a action=%ACTION_ENABLE%
goto reParseParams
)
IF /i "%~1"=="/enable" (
SET /a action=%ACTION_ENABLE%
goto reParseParams
)
IF /i "%~1"=="/x" (
SET /a action=%ACTION_DELETE%
goto reParseParams
)
IF /i "%~1"=="/delete" (
SET /a action=%ACTION_DELETE%
goto reParseParams
)
IF /i "%~1"=="/n" (
SET "name=%~2"
SHIFT
goto reParseParams
)
IF /i "%~1"=="/name" (
SET "name=%~2"
SHIFT
goto reParseParams
)
IF /i "%~1"=="/v" (
SET /a verbose=1
goto reParseParams
)
IF /i "%~1"=="/h" (
goto help
)
:reParseParams
SHIFT
if [%1]==[] goto main
GOTO :ParseParams
:main
if %verbose% EQU 1 (
echo action: %action%
)
if %action% EQU %ACTION_DISABLE% (
if ["%name%"] NEQ [""] (
echo disabling %name%
call :disableTask "%name%"
) else (
for /d %%i in %names% do (
echo disabling %%~i
call :disableTask "%%~i"
echo.
echo.
)
)
) else if %action% EQU %ACTION_ENABLE% (
if ["%name%"] NEQ [""] (
echo enabling %name%
call :enableTask "%name%"
) else (
for /d %%i in %names% do (
echo enabling %%i
call :enableTask "%%i"
echo.
echo.
)
)
) else if %action% EQU %ACTION_DELETE% (
if ["%name%"] NEQ [""] (
echo deleting %name%
call :deleteTask "%name%"
) else (
for /d %%i in %names% do (
echo deleting %%i
call :deleteTask "%%i"
echo.
echo.
)
)
) else if %action% EQU %ACTION_CHECK% (
if ["%name%"] NEQ [""] (
echo checking %name%
call :checkTask "%name%"
) else (
for /d %%i in %names% do (
echo checking %%i
call :checkTask "%%i"
echo.
echo.
)
)
) else (
echo [e] Action %action% is not supported!
goto mainend
)
:mainend
endlocal
exit /b %errorlevel%
:disableTask
setlocal
set "name=%~1"
echo disableTask
echo name: %name%
schtasks /End /TN "%name%"
schtasks /Change /TN "%name%" /Disable
endlocal
exit /b %errorlevel%
:enableTask
setlocal
set "name=%~1"
schtasks /Change /TN "%name%" /Enable
schtasks /Run /TN "%name%"
endlocal
exit /b %errorlevel%
:deleteTask
setlocal
set "name=%~1"
schtasks /End /TN "%name%"
schtasks /Delete /TN "%name%" /f
endlocal
exit /b %errorlevel%
:checkTask
setlocal
set "name=%~1"
schtasks /Query /TN "%name%"
endlocal
exit /b %errorlevel%
:usage
echo Usage: %my_name% [/c^|/d^|/e] [/n ^<name^>] [/v] [/h]
exit /B 0
:help
call :usage
echo.
echo Targets: !! Not selectable, just for info !!
echo \Microsoft\Windows\AccountHealth\RecoverabilityToastTask : AccountHealth Task Handler evaluates the state of a Microsoft Account and takes any necessary repair action
echo \Microsoft\Windows\CloudExperienceHost\CreateObjectTask : ??
echo \Microsoft\Windows\CloudRestore\Backup : Handles restoring settings from the cloud
echo \Microsoft\Windows\Customer Experience Improvement Program\
echo Consolidator : If the user has consented to participate in the Windows Customer Experience Improvement Program, this job collects and sends usage data to Microsoft.
echo UsbCeip : The USB CEIP (Customer Experience Improvement Program) task collects Universal Serial Bus related statistics and information about your machine and sends it to the Windows Device Connectivity engineering group at Microsoft. The information received is used to help improve the reliability, stability, and overall functionality of USB in Windows. If the user has not consented to participate in Windows CEIP, this task does not do anything.
echo \Microsoft\Windows\Flighting\ : Flighting is the process of running Windows Insider Preview Builds on your device. When you run these early versions of Windows and give us feedback, you can help us shape the future of Windows. Once you've registered for the program, you can run Insider Preview builds on as many devices as you want, each in the channel of your choice.
echo FeatureConfig\
echo BootstrapUsageDataReporting: Task periodically logging feature usage reports
echo GovernedFeatureUsageProcessing: Task periodically reconciling feature configurations
echo ReconcileConfigs: Task periodically reconciling feature configurations
echo ReconcileFeatures: Task periodically reconciling feature configurations
echo UsageDataFlushing: Task persisting feature usage data to disk
echo UsageDataReceiver: Task persisting feature usage data to disk
echo UsageDataReporting: Task periodically logging feature usage reports
echo OneSettings\
echo RefreshCache : Task periodically refreshing data for OneSettings clients.
echo \Microsoft\Windows\International\Synchronize Language Settings : Synchronize User Language Settings from other devices.
echo \Microsoft\Windows\Maps\
echo MapsToastTask : This task shows various Map related toasts
echo MapsUpdateTask : This task checks for updates to maps which you have downloaded for offline use. Disabling this task will prevent Windows from notifying you of updated maps.
echo \Microsoft\Windows\User Profile Service\HiveUploadTask : This task will automatically upload a roaming user profile's registry hive to its network location.
echo \Microsoft\Windows\Windows Error Reporting\QueueReporting : Windows Error Reporting task to process queued reports.
echo \Microsoft\Windows\WindowsAI\Recall\
echo InitialConfiguration : ??
echo PolicyConfiguration : ??
echo \Microsoft\Windows\WindowsAI\Settings\
echo InitialConfiguration: ??
echo.
echo Actions:
echo /c : Check the task(s).
echo /d : Disable the task(s).
echo /e : Enable the task(s).
echo /x : Delete the task(s). Some task can't be disabled but deleted.
echo.
echo Options:
echo /n : Name a specific arbitrary target task.
echo.
echo Other:
echo /v: More verbose.
echo /h: Print this.
echo.
echo Defaults to check all targets.
exit /B 0