Repository navigation
Expand file tree
/
Copy pathdisableServices.bat
More file actions
397 lines (350 loc) · 15.9 KB
/
Copy pathdisableServices.bat
File metadata and controls
397 lines (350 loc) · 15.9 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
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
::
:: Disable a list of services you might not need to be running
::
:: Uses sc manager
:: Can fail some time due to access restrictions
:: Using the reg keys is less restricted
::
:: vs 1.0.2
:: date 16.06.2025
::
@echo off
setlocal
set my_name=%~n0%~x0
set my_dir="%~dp0"
set "my_dir=%my_dir:~1,-2%"
set /a MODE_SC=1
set /a MODE_REG=2
set /a mode=%MODE_SC%
set /a ACTION_DISABLE=1
set /a ACTION_ENABLE=2
set /a ACTION_CHECK=3
set /a action=%ACTION_CHECK%
set /a START_TYPE_BOOT=0
set /a START_TYPE_SYSTEM=1
set /a START_TYPE_AUTO=2
set /a START_TYPE_DEMAND=3
set /a START_TYPE_DISABLED=4
set /a enable_start_type=%START_TYPE_AUTO%
set /a verbose=0
set name=
set common_scv=(^
AppVClient^
BcastDVRUserService^
BluetoothUserService^
BTAGService^
bthserv^
CDPSvc^
cloudidsvc^
CloudBackupRestoreSvc^
cphs^
cplspcon^
DiagTrack^
DialogBlockingService^
GameInputSvc^
HfcDisableService^
icssvc^
igccservice^
igfxCUIService2.0.0.0^
jhi_service^
lfsvc^
lldpsvc^
lms^
MapsBroker^
McpManagementService^
MsKeyboardFilter^
NcbService^
NetTcpPortSharing^
OneSyncSvc^
PeerDistSvc^
PenService^
perceptionsimulation^
PrintDeviceConfigurationService^
PhoneSvc^
PrintDeviceConfigurationService^
RemoteAccess^
RemoteRegistry^
SEMgrSvc^
SensorDataService^
SensorService^
SensrSvc^
SessionEnv^
shpamsvc^
SNMPTrap^
SSDPSRV^
TapiSrv^
TermService^
TokenBroker^
tzautoupdate^
UevAgentService^
UmRdpService^
WarpJITSvc^
WbioSrvc^
WerSvc^
WinRM^
whesvc^
wlidsvc^
WpcMonSvc^
XboxGipSvc^
XblAuthManager^
XblGameSave^
XboxNetApiSvc^
XTU3SERVICE^
)
set hp_svc=(^
HotKeyServiceDSU^
)
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"=="/r" (
SET /a mode=%MODE_REG%
goto reParseParams
)
IF /i "%~1"=="/reg" (
SET /a mode=%MODE_REG%
goto reParseParams
)
IF /i "%~1"=="/s" (
SET /a mode=%MODE_SC%
goto reParseParams
)
IF /i "%~1"=="/sc" (
SET /a mode=%MODE_SC%
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%
echo mode: %mode%
)
if %action% EQU %ACTION_DISABLE% (
if ["%name%"] NEQ [""] (
echo disabling %name%
call :disableSrvc "%name%"
) else (
for /d %%i in %common_scv% do (
echo disabling %%i
call :disableSrvc "%%i"
echo.
echo.
)
)
) else if %action% EQU %ACTION_ENABLE% (
if ["%name%"] NEQ [""] (
echo enabling %name%
call :enableSrvc "%name%"
) else (
for /d %%i in %common_scv% do (
echo enabling %%i
call :enableSrvc "%%i"
echo.
echo.
)
)
) else if %action% EQU %ACTION_CHECK% (
if ["%name%"] NEQ [""] (
echo checking %name%
call :checkSrvc "%name%"
) else (
for /d %%i in %common_scv% do (
echo checking %%i
call :checkSrvc "%%i"
echo.
echo.
)
)
) else (
echo [e] Mode %mode% is not supported!
goto mainend
)
:mainend
endlocal
exit /b %errorlevel%
:disableSrvc
setlocal
set "name=%~1"
if %mode% EQU %MODE_SC% (
for /F "tokens=3 delims=: " %%H in ('sc query "%name%" ^| findstr " STATE"') do (
if /I "%%H" EQU "RUNNING" (
sc stop "%name%"
)
)
sc config "%name%" start= disabled
) else if %mode% EQU %MODE_REG% (
reg add "HKLM\SYSTEM\CurrentControlSet\Services\%name%" /v "Start" /t REG_DWORD /d %START_TYPE_DISABLED% /f
)
endlocal
exit /b %errorlevel%
:enableSrvc
setlocal
set "name=%~1"
if %mode% EQU %MODE_SC% (
for /F "tokens=3 delims=: " %%H in ('sc query "%name%" ^| findstr " STATE"') do (
if /I "%%H" EQU "STOPPED" (
sc start "%name%"
)
)
sc config "%name%" start= auto
) else if %mode% EQU %MODE_REG% (
reg add "HKLM\SYSTEM\CurrentControlSet\Services\%name%" /v "Start" /t REG_DWORD /d %enable_start_type% /f
)
endlocal
exit /b %errorlevel%
:checkSrvc
setlocal
set "name=%~1"
if %mode% EQU %MODE_SC% (
echo Status:
sc query "%name%"
echo.
echo Configuration:
sc qc "%name%"
echo.
echo Description:
sc qdescription "%name%"
) else if %mode% EQU %MODE_REG% (
reg query "HKLM\SYSTEM\CurrentControlSet\Services\%name%" /v "Start"
)
endlocal
exit /b %errorlevel%
:usage
echo Usage: %my_name% [/c^|/d^|/e] [/reg^|/sc] [/n ^<name^>] [/v] [/h]
exit /B 0
:help
call :usage
echo.
echo Targets: !! Not selectable, just for info !!
echo AppVClient : Microsoft App-V Client: Manages App-V users and virtual applications
echo BcastDVRUserService : GameDVR and Broadcast User Service: This user service is used for Game Recordings and Live Broadcasts
echo BluetoothUserService_cfa74: Bluetooth User Support Service: The Bluetooth user service supports proper functionality of Bluetooth features relevant to each user session.
echo BTAGService: Service supporting the audio gateway role of the Bluetooth Handsfree Profile.
echo bthserv: The Bluetooth service supports discovery and association of remote Bluetooth devices.
echo CDPSvc: This service is used for Connected Devices Platform scenarios. The service does exactly that it checks for “ connected” devices and authenticates then so that data can be transferred between them later seamlessly. These also include any wireless printers, phones etc on the network.
echo cloudidsvc: Supports integrations with Microsoft cloud identity services.
echo CloudBackupRestoreSvc: Cloud Backup and Restore Service: Monitors the system for changes in application and setting states and performs cloud backup and restore operations when required.
echo cphs: Intel(R) Content Protection HECI Service: Intel(R) Content Protection HECI Service - enables communication with the Content Protection FW
echo cplspcon: Intel(R) Content Protection HDCP Service: Intel(R) Content Protection HDCP Service - enables communication with Content Protection HDCP HW
echo DiagTrack: Connected User Experiences and Telemetry: The Connected User Experiences and Telemetry service enables features that support in-application and connected user experiences. Additionally, this service manages the event driven collection and transmission of diagnostic and usage information (used to improve the experience and quality of the Windows Platform) when the diagnostics and usage privacy option settings are enabled under Feedback and Diagnostics.
echo DialogBlockingService: DialogBlockingService: Dialog Blocking Service
REM echo DoSvc: Delivery Optimization: Performs content delivery optimization tasks. [Windows Updates depend on it!]
echo GameInputSvc: Enables keyboards, mice, gamepads, and other input devices to be used with the GameInput API.
echo HfcDisableService: Intel(R) RST HFC Disable Service: Turns off hiberfile caching in Intel(R) RST driver.
echo icssvc: Provides the ability to share a cellular data connection with another device.
echo igccservice: Service for Intel(R) Graphics Command Center.
echo igfxCUIService2.0.0.0: Service for Intel(R) HD Graphics Control Panel.
echo jhi_service: Intel(R) Dynamic Application Loader Host Interface Service.
echo lfsvc: This service monitors the current location of the system and manages geofences.
echo lms: Intel(R) Management and Security Application Local Management Service - Provides OS-related Intel(R) ME functionality.
echo MapsBroker: Windows service for application access to downloaded maps.
echo McpManagementService: McpManagementService: Universal Print Management Service
echo MsKeyboardFilter: Microsoft Keyboard Filter: Controls keystroke filtering and mapping
echo NcbService: Network Connection Broker: Brokers connections that allow packaged Microsoft Store apps to receive notifications from the internet.
echo NetTcpPortSharing: Net.Tcp Port Sharing Service: Provides ability to share TCP ports over the net.tcp protocol.
echo OneSyncSvc: Sync Host: This service synchronizes mail, contacts, calendar and various other user data. Mail and other applications dependent on this functionality will not work properly when this service is not running.
echo PeerDistSvc: This service caches network content from peers on the local subnet.
echo PenService: PenService: Pen Service
echo perceptionsimulation: Windows Perception Simulation Service: Enables spatial perception simulation, virtual camera management and spatial input simulation.
echo PerfHost: Performance Counter DLL Host: Enables remote users and 64-bit processes to query performance counters provided by 32-bit DLLs. If this service is stopped, only local users and 32-bit processes will be able to query performance counters provided by 32-bit DLLs.
echo PhoneSvc: Manages the telephony state on the device.
echo PrintDeviceConfigurationService: Print Device Configuration Service: The Print Device Configuration Service manages the installation of IPP and UP printers. If this service is stopped, any printer installations that are in-progress may be canceled.
echo RemoteAccess: Offers routing services to businesses in local area and wide area network environments.
echo RemoteRegistry: Enables remote users to modify registry settings on this computer.
echo SEMgrSvc: Manages payments and Near Field Communication (NFC) based secure elements.
echo SensorDataService: Sensor Data Service: Delivers data from a variety of sensors
echo SensorService: Sensor Service: A service for sensors that manages different sensors' functionality. Manages Simple Device Orientation (SDO) and History for sensors. Loads the SDO sensor that reports device orientation changes. If this service is stopped or disabled, the SDO sensor will not be loaded and so auto-rotation will not occur. History collection from Sensors will also be stopped.
echo SensrSvc: Sensor Monitoring Service: Monitors various sensors in order to expose data and adapt to system and user state. If this service is stopped or disabled, the display brightness will not adapt to lighting conditions. Stopping this service may affect other system functionality and features as well.
echo SessionEnv: Remote Desktop Configuration: Remote Desktop Configuration service (RDCS) is responsible for all Remote Desktop Services and Remote Desktop related configuration and session maintenance activities that require SYSTEM context. These include per-session temporary folders, RD themes, and RD certificates.
echo shpamsvc: Shared PC Account Manager: Manages profiles and accounts on a SharedPC configured device
echo SNMPTrap: Receives trap messages generated by local or remote Simple Network Management Protocol (SNMP) agents and forwards the messages to SNMP management programs running on this computer.
echo SSDPSRV: Discovers networked devices and services that use the SSDP discovery protocol, such as UPnP devices.
echo TapiSrv: Provides Telephony API (TAPI) support for programs that control telephony devices on the local computer and, through the LAN, on servers that are also running the service.
echo TermService: Remote Desktop Services: Allows users to connect interactively to a remote computer. Remote Desktop and Remote Desktop Session Host Server depend on this service. To prevent remote use of this computer, clear the checkboxes on the Remote tab of the System properties control panel item.
echo TokenBroker: This service is used by Web Account Manager to provide single-sign-on to apps and services.
echo tzautoupdate: Auto Time Zone Updater: Automatically sets the system time zone.
echo UevAgentService: User Experience Virtualization Service: Provides support for application and OS settings roaming
echo UmRdpService: Remote Desktop Services UserMode Port Redirector: Allows the redirection of Printers/Drives/Ports for RDP connections
echo WarpJITSvc: Enables JIT compilation support in d3d10warp.dll for processes in which code generation is disabled.
echo WbioSrvc: The Windows biometric service gives client applications the ability to capture, compare, manipulate, and store biometric data without gaining direct access to any biometric hardware or samples.
echo WerSvc: Allows errors to be reported when programs stop working or responding and allows existing solutions to be delivered.
REM echo WinHTTPAutoProxySvc: WinHTTP implements the client HTTP stack and provides developers with a Win32 API and COM Automation component for sending HTTP requests and receiving responses. [Required by WLAN service!]
echo WinRM: Windows Remote Management (WinRM) service implements the WS-Management protocol for remote management.
echo whesvc : Windows Health and Optimized Experiences : Monitors the device for a better user experience
echo wlidsvc: Enables user sign-in through Microsoft account identity services. If this service is stopped, users will not be able to logon to the computer with their Microsoft account.
echo WpcMonSvc: Enforces parental controls for child accounts in Windows. If this service is stopped or disabled, parental controls may not be enforced.
echo XboxGipSvc: This service manages connected Xbox Accessories.
echo XblAuthManager: Provides authentication and authorization services for interacting with Xbox Live. If this service is stopped, some applications may not operate correctly.
echo XblGameSave: This service syncs save data for Xbox Live save enabled games. If this service is stopped, game save data will not upload to or download from Xbox Live.
echo XboxNetApiSvc: This service supports the Windows.Networking.XboxLive application programming interface.
echo XTU3SERVICE: XTUOCDriverService: Intel(R) Overclocking Component Service
echo.
echo Known unneccessary hp services.
echo Could be disabled manually.
for /d %%i in %hp_svc% do (
echo - %%i
)
echo.
echo Actions:
echo /c : Check the services.
echo /d : Disable the services.
echo /e : Enable the services.
echo.
echo Options:
echo /n : Name a specific arbitrary target.
echo /reg : Use registry to overwrite service start setting.
echo /sc : Use sc service manager to manage service start setting (default).
echo.
echo Other:
echo /v: More verbose.
echo /h: Print this.
echo.
echo Defaults to disable all targets.
exit /B 0