forked from bmrf/standalone_scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
windows_services_lockdown.bat
1280 lines (1061 loc) · 54.2 KB
/
windows_services_lockdown.bat
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
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
:: Purpose: Locks down/turns off unnecessary Windows services. Can also undo this lockdown operation.
:: Requirements: Administrator access. Some services don't exist if a Service Pack is missing; this is okay, they'll just be skipped.
:: Author: reddit.com/user/vocatus ( vocatus.gate at gmail ) // PGP key: 0x07d1490f82a211a2
:: Version: 2.2.2 Loopified most command blocks, significantly reducing script size
:: 2.2.1 Switched to CUR_DATE format to be consistent with all other scripts
:: 2.2.0 Added /y switch to a few commands to auto-answer yes instead of prompting
:: 2.1.0 Added very minor logging function
:: 2.0.0 Massive re-write. New menus, new logic and flow, new services, new
:: Operating Systems added (Vista/7/XP x64), Windows XP updated to SP3.
:: 1.0.0 Original script (Windows XP SP2 only)
:: NOTES
:: ---------------------------------
:: BlackViper.com is due original credit for the four levels of "aggressiveness" for
:: locking down services (he calls his default/safe/tweaked/bare-bones).
:: These profiles are identical to his with the exception of two things:
:: 1. The "moderate" profile deviates from his to suite my tastes, and 2. I retained
:: network functionality in the "aggressive" profiles.
:: MISC
:: ---------------------------------
:: This script uses the "main code block plus add-on code block" method for the profiles to cut
:: down on the size of the script. Behind the scenes, for each OS, there are two "base" profiles
:: and two "add-on" profiles. First, one is run, then (if selected) the other block is run
:: afterwards. Rather than create an entire service configuration script for each profile, I just
:: have the "add-on" profile run as an addendum to the "base" profile. An example are the "Default"
:: and "Minor" profiles. "Default" forms the base for "Minor", since they are so similar. This adds
:: some craziness to the logic...but I managed to solve it by using two variables, basePROFILE and
:: PROFILE. basePROFILE sets our start point and PROFILE sets our overall profile. "If" statements
:: evaluate those two variables at the end of each Profile code block and act accordingly.
:: USER FLOW
:: ---------------------------------
:: The user sees these screens in order:
:: 1. Warning/welcome
:: 2. Operating System choice menu
:: 3. "Profile" choice menu
:: 4. "Apply Now or later?" menu
:: 5. Confirmation menu
:: - execution
:: 6. End screen.
:: CODE INDEX (top-to-bottom layout)
:: ---------------------------------
:: 0. Console prep and variable declaration
:: 1. Welcome/warning screen
:: 2. Operating System menu
:: 3. Windows XP 32-bit, Profile menu
:: - Default
:: - Default ("apply Now" supplement)
:: - Minor
:: - Minor ("apply Now" supplement)
:: - Moderate
:: - Moderate ("apply Now" supplement)
:: - Aggressive
:: - Aggressive ("apply Now" supplement)
:: 4. Windows Vista 32-bit, Profile menu
:: - Default
:: - Default ("apply Now" supplement)
:: - Minor
:: - Minor ("apply Now" supplement)
:: - Moderate
:: - Moderate ("apply Now" supplement)
:: - Aggressive
:: - Aggressive ("apply Now" supplement)
:: 5. Windows 7 32-bit, Profile menu
:: - Default
:: - Default ("apply Now" supplement)
:: - Minor
:: - Minor ("apply Now" supplement)
:: - Moderate
:: - Moderate ("apply Now" supplement)
:: - Aggressive
:: - Aggressive ("apply Now" supplement)
:: 6. Windows XP 64-bit, Profile menu
:: - Default
:: - Default ("apply Now" supplement)
:: - Minor
:: - Minor ("apply Now" supplement)
:: - Moderate
:: - Moderate ("apply Now" supplement)
:: - Aggressive
:: - Aggressive ("apply Now" supplement)
:: 7. End screen
SETLOCAL
:::::::::::::::
:: VARIABLES :: -------------- These are the defaults. Change them if you so desire. --------- ::
:::::::::::::::
:: Log location
set LOGPATH=%systemDrive%\Logs
set LOGFILE=%COMPUTERNAME%_Windows_Services_Lockdown.log
:: This makes sure log file exists
if not exist %LOGPATH% mkdir %LOGPATH%
if not exist %LOGPATH%\%LOGFILE% echo. > %LOGPATH%\%LOGFILE%
:: --------------------------- Don't edit anything below this line --------------------------- ::
:::::::::::::::::::::
:: PREP AND CHECKS ::
:::::::::::::::::::::
@echo off
cls
set SCRIPT_VERSION=2.2.2
set SCRIPT_DATE=2015-08-28
set WIN_VER=--
set namePROFILE=--
set WHEN_TO_APPLY=--
:: Get the date into ISO 8601 standard date format (yyyy-mm-dd) so we can use it
FOR /f %%a in ('WMIC OS GET LocalDateTime ^| find "."') DO set DTS=%%a
set CUR_DATE=%DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2%
:::::::::::::
:: EXECUTE ::
:::::::::::::
:: Welcome / Warning screen
:warning
color 0c
title Windows Services Lockdown v%SCRIPT_VERSION%
cls
echo.
echo ********************************* WARNING *********************************
echo * *
echo * HEY!! Read this! It's important. *
echo * *
echo * This script disables unnecessary Windows services (hidden programs). *
echo * This is a good thing - it reduces RAM usage and attack surface. However,*
echo * sometimes it disables a service that you were using and didn't know *
echo * about, causing errors, program crashes, and/or explosions in Italy. *
echo * *
echo * GOOD NEWS! This is easy to fix. If you have *ANY* problems after using *
echo * this script, just run it again and choose option 1: "defaults" for your *
echo * operating system. Everything will be restored to the default state. *
echo * *
echo * One last thing - you have to run this script as an ADMINISTRATOR. *
echo * *
echo * Ready? Press any key to go to the main menu... *
echo * *
echo ***************************************************************************
echo.
pause
:: Welcome screen
:os_menu
::color 17 is white on blue
color 17
cls
echo.
echo WINDOWS SERVICES LOCKDOWN - STEP 1/3
echo.
echo Step 1: Choose OS: %WIN_VER%
echo Step 2: Choose Profile: %namePROFILE%
echo Step 3: Confirm
echo.
echo.
echo Select the operating system you are using
echo.
echo -----------------------------------------------------------------------
echo Operating System Architecture Service Pack
echo -----------------------------------------------------------------------
echo 1. Windows XP 32-bit up to SP3
echo 2. Windows XP 64-bit up to SP2
echo 3. Windows Vista 32-bit/64-bit up to SP2
echo 4. Windows 7 32-bit/64-bit up to SP1
echo.
echo 5. Exit
echo.
echo.
:: menu: Setup menu processing
:os_menuChoice
set /p choice=Choice:
if not '%choice%'=='' set choice=%Choice:~0,1%
if '%choice%'=='1' goto XP_32_menu_profile
if '%choice%'=='2' goto XP_64_menu_profile
if '%choice%'=='3' goto Vista_32_menu_profile
if '%choice%'=='4' goto 7_32_menu_profile
if '%choice%'=='5' goto quit
:: Else, go back and re-draw the menu
echo.
echo "%choice%" is not valid, please try again
echo.
goto os_menuChoice
:XP_32_menu_profile
:: This is where the user selects the lockdown profile to use. Pretty self-explanatory.
set WIN_VER=Windows XP 32-bit
title Services Lockdown - %WIN_VER%
cls
echo.
echo WINDOWS SERVICES LOCKDOWN - STEP 2/3
echo.
echo Step 1: Choose OS: %WIN_VER%
echo Step 2: Choose Profile: %namePROFILE%
echo Step 3: Confirm
echo.
echo.
echo Select the lockdown profile to apply to 87 services
echo -----------------------------------------------------------------------
echo PROFILE Disabled On-demand Running Total
echo -----------------------------------------------------------------------
echo 1. Windows Defaults 6 36 39 81
echo 2. Minor 26 29 26 81
echo 3. Moderate (recommended) 52 19 16 87
echo 4. Aggressive 72 5 10 87
echo.
echo 5. Go back to Operating System choices
echo.
echo.
:XP_32_menu_profileChoice
set /p choice=Choice:
if not '%choice%'=='' set choice=%Choice:~0,1%
if '%choice%'=='1' set PROFILE=XP_32_default && set basePROFILE=XP_32_default && set namePROFILE=Default&& goto XP_32_menu_confirm
if '%choice%'=='2' set PROFILE=XP_32_minor && set basePROFILE=XP_32_default && set namePROFILE=Minor&& goto XP_32_menu_confirm
if '%choice%'=='3' set PROFILE=XP_32_moderate && set basePROFILE=XP_32_moderate && set namePROFILE=Moderate&& goto XP_32_menu_confirm
if '%choice%'=='4' set PROFILE=XP_32_aggressive && set basePROFILE=XP_32_moderate && set namePROFILE=Aggressive&& goto XP_32_menu_confirm
if '%choice%'=='5' set WIN_VER=-- && echo. && cls && goto os_menu
:: Else, go back and re-draw the menu
echo.
echo "%choice%" is not valid, please try again
echo.
goto XP_32_menu_profileChoice
:XP_32_menu_confirm
:: Confirm the profile and execute
set WIN_VER=Windows XP 32-bit
title Services Lockdown - %WIN_VER%
cls
echo.
echo WINDOWS SERVICES LOCKDOWN - STEP 3/3
echo.
echo Step 1: Choose OS: %WIN_VER%
echo Step 2: Choose Profile: %namePROFILE%
echo Step 3: Confirm
echo.
echo.
echo ABOUT TO APPLY THE %WIN_VER% "%namePROFILE%" CONFIGURATION!
echo.
echo.
echo CONFIRM?
echo.
echo 1. Yes - changes take effect immediately
echo 2. Yes - changes take effect after reboot (coward! do it now!)
echo.
echo 3. No - go back to profile selection
echo.
echo.
:XP_32_menu_confirmChoice
set /p choice=Choice:
if not '%choice%'=='' set choice=%Choice:~0,1%
if '%choice%'=='1' set WHEN_TO_APPLY=Now && goto %basePROFILE%
if '%choice%'=='2' set WHEN_TO_APPLY=reboot && goto %basePROFILE%
if '%choice%'=='3' set namePROFILE=-- && goto XP_32_menu_profile
echo.
echo "%choice%" is not valid, please try again
echo.
goto XP_32_menu_confirmChoice
:XP_32_default
:: Operating system defaults. Default also forms the base for the Minor profile.
cls
title Resetting to defaults...
echo.
echo Now resetting all services to the %WIN_VER% defaults, please wait...
echo.
echo Setting the following services to "Automatically start":
for %%i in (AudioSrv,Browser,CryptSvc,DcomLaunch,Dhcp,dmserver,Dnscache,ERSvc,Eventlog,helpsvc,lanmanserver,lanmanworks,ation,LmHosts,PlugPlay,PolicyAgent,ProtectedStorage,RemoteRegistry,RpcSs,SamSs,Schedule,seclogon,SENS,Share,Access,ShellHWDetection,Spooler,srservice,Themes,TrkWks,W32Time,WebClient,winmgmt,wscsvc,wuauserv,WZCSVC) do (
echo %%i...
sc config %%i start= auto 2>NUL
)
echo Setting the following services to "Only start on demand":
for %%i in (ALG,AppMgmt,BITS,cisvc,COMSysApp,dmadmin,Dot3svc,EapHost,EventSystem,FastUserSwitchingCompatibility,hkmsvc,HTTPFilter,ImapiService,mnmsrvc,MSDTC,MSIServer,napagent,Netlogon,Netman,Nla,NtLmSsp,NtmsSvc,RasAuto,RasMan,RDSessMgr,RpcLocator,RSVP,SCardSvr,SSDPSRV,stisvc,SwPrv,SysmonLog,TapiSrv,TermService,TlntSvr,upnphost,UPS,V,S,WmdmPmSN,Wmi,WmiApSrv,xmlprov
) do (
echo %%i...
sc config %%i start= demand 2>NUL
)
echo Setting the following services to "Disabled":
for %%i in (Alerter,ClipSrv,HidServ,Messenger,NetDDE,NetDDEdsdm,RemoteAccess) do (
echo Disabling %%i...
sc config %%i start= disabled 2>NUL
)
if %WHEN_TO_APPLY%==Now goto XP_32_default_Now
if %PROFILE%==XP_32_minor goto XP_32_minor
goto end
:XP_32_default_Now
:: This section runs after the profile above, if selected. It applies changes immediately.
echo Starting the following services:
for %%i in (AudioSrv,Browser,CryptSvc,DcomLaunch,Dhcp,dmserver,Dnscache,ERSvc,Eventlog,FastUserSwitchingCompatibility,h,lpsvc,HidServ,lanmanserver,lanmanworkstation,LmHosts,mnmsrvc,Netlogon,PlugPlay,PolicyAgent,ProtectedStorage,RemoteRegistry,RpcSs,SamSs,Schedule,seclogon,SENS,SharedAccess,ShellHWDetection,Spooler,srservice,SSDPSRV,T,emes,TrkWks,W32Time,WebClient,winmgmt,wscsvc,wuauserv,WZCSVC) do (
echo Starting %%i...
net start %%i 2>NUL
)
echo Stopping the following services:
for %%i in (Alerter,ALG,AppMgmt,BITS,cisvc,ClipSrv,COMSysApp,dmadmin,Dot3svc,EapHost,hkmsvc,HTTPFilter,ImapiService,Mes,enger,MSDTC,MSIServer,napagent,NetDDE,NetDDEdsdm,Nla,NtLmSsp,NtmsSvc,RasAuto,RasMan,RDSessMgr,RemoteAccess,RpcLocator,RSVP,SCardSvr,stisvc,SwPrv,SysmonLog,TapiSrv,TermService,TlntSvr,upnphost,UPS,VSS,WmdmPmSN,Wmi,Wm,ApSrv,xmlprov) do (
echo Stopping %%i...
net stop %%i 2>NUL
)
net stop EventSystem /y
net stop Netman /y
if %PROFILE%==XP_32_minor goto XP_32_minor
goto end
:XP_32_minor
:: If it was selected, the Minor profile runs after Default as addendum.
cls
title Applying %PROFILE% settings...
echo.
echo Now applying %PROFILE% settings, please wait...
echo.
echo Setting the following services to "Only start on demand":
for %%i in (dmserver,TrkWks,W32Time) do (
echo %%i...
sc config %%i start= demand 2>NUL
)
echo Setting the following services to "Disabled":
for %%i in (cisvc,ERSvc,helpsvc,LmHosts,mnmsrvc,RDSessMgr,RemoteRegistry,RSVP,SCardSvr,seclogon,TlntSvr,UPS,WebClient,WdmPmSN,WmiApSrv,xmlprov) do (
echo Disabling %%i...
sc config %%i start= disabled 2>NUL
)
if %WHEN_TO_APPLY%==Now goto XP_32_minor_Now
goto end
:XP_32_minor_Now
:: This section runs after the profile above, if selected. It applies changes immediately.
echo Stopping the following services:
for %%i in (cisvc,dmserver,ERSvc,helpsvc,LmHosts,mnmsrvc,RDSessMgr,RemoteRegistry,RSVP,SCardSvr,seclogon,TlntSvr,TrkWks,UPS,W32Time,WebClient,WmdmPmSN,WmiApSrv,xmlprov) do (
echo Stopping %%i...
net stop %%i 2>NUL
)
If we executed this block then there's nothing left to do, so we go to the end. whew!
goto end
:XP_32_moderate
:: The Moderate profile forms the base for the Aggressive profile
cls
title Applying %PROFILE% settings...
echo.
echo Now applying %PROFILE% settings, please wait...
echo.
echo Setting the following services to "Automatically start":
for %%i in (AudioSrv,CryptSvc,DcomLaunch,Dhcp,Eventlog,lanmanserver,lanmanworkstation,PlugPlay,RpcSs,SamSs,SharedAccess,Spooler,winmgmt,wuauserv,WZCSVC) do (
echo %%i...
sc config %%i start= auto 2>NUL
)
echo Setting the following services to "Only start on demand":
for %%i in (AppMgmt,BITS,Browser,COMSysApp,dmadmin,dmserver,Dnscache,EventSystem,FastUserSwitchingCompatibility,ImapiService,MSIServer,napagent,Netman,Nla,NtLmSsp,RpcLocator,SCardSvr,Schedule,seclogon,ShellHWDetection,TapiSrv,TermService,TrkWks,Wmi) do (
echo %%i...
sc config %%i start= demand 2>NUL
)
echo Setting the following services to "Disabled":
for %%i in (Alerter,ALG,cisvc,ClipSrv,Dot3svc,EapHost,ERSvc,helpsvc,HidServ,hkmsvc,HTTPFilter,LmHosts,Messenger,mnmsrvc,MSDTC,NetDDE,NetDDEdsdm,Netlogon,NtmsSvc,PolicyAgent,ProtectedStorage,RasAuto,RasMan,RDSessMgr,RemoteAccess,RemoteRegistry,RSVP,SENS,srservice,SSDPSRV,stisvc,SwPrv,SysmonLog,Themes,TlntSvr,upnphost,UPS,VSS,W32Time,WebClient,WmdmPmSN,WmiApSrv,wscsvc,xmlprov) do (
echo Disabling %%i...
sc config %%i start= disabled 2>NUL
)
if %WHEN_TO_APPLY%==Now goto XP_32_moderate_Now
if %PROFILE%==XP_32_aggressive goto XP_32_aggressive
goto end
:XP_32_moderate_Now
:: This section runs after the profile above, if selected. It applies changes immediately.
echo Starting the following services:
for %%i in (AudioSrv,CryptSvc,DcomLaunch,Dhcp,Eventlog,lanmanserver,lanmanworkstation,PlugPlay,RpcSs,SamSs,SharedAccess,Spooler,winmgmt,wuauserv,WZCSVC) do (
echo Starting %%i...
net start %%i 2>NUL
)
echo Stopping the following services:
for %%i in (Alerter,ALG,AppMgmt,BITS,Browser,cisvc,ClipSrv,COMSysApp,dmadmin,dmserver,Dnscache,Dot3svc,EapHost,ERSvc,FastUserSwitchingCompatibility,helpsvc,HidServ,hkmsvc,HTTPFilter,ImapiService,LmHosts,Messenger,mnmsrvc,MSDTC,MSIServer,napagent,NetDDE,NetDDEdsdm,Netlogon,Nla,NtLmSsp,NtmsSvc,PolicyAgent,ProtectedStorage,RasAuto,RasMan,RDSessMgr,RemoteAccess,RemoteRegistry,RpcLocator,RSVP,SCardSvr,Schedule,seclogon,SENS,ShellHWDetection,srservice,SSDPSRV,stisvc,SwPrv,SysmonLog,TapiSrv,TermService,Themes,TlntSvr,TrkWks,upnphost,UPS,VSS,W32Time,WebClient,WmdmPmSN,Wmi,WmiApSrv,wscsvc,xmlprov) do (
echo Stopping %%i...
net stop %%i 2>NUL
)
net stop EventSystem /y
net stop Netman /y
if %PROFILE%==XP_32_aggressive goto XP_32_aggressive
goto end
:XP_32_aggressive
:: If it was selected, the Aggressive profile runs after the Moderate profile, as an addendum.
cls
title Applying %PROFILE% settings...
echo.
echo Now applying %PROFILE% settings, please wait...
echo.
echo Now applying Aggressive profile...
echo Setting the following services to "Only start on demand":
for %%i in (Spooler,wuauserv) do (
echo %%i...
sc config %%i start= demand 2>NUL
)
echo Setting the following services to "Disabled":
for %%i in (AppMgmt,Browser,COMSysApp,CryptSvc,dmadmin,dmserver,Dnscache,EventSystem,FastUserSwitchingCompatibility,ImapiService,lanmanserver,Nla,NtLmSsp,RpcLocator,SCardSvr,Schedule,seclogon,ShellHWDetection,TapiSrv,TermService,TrkWks) do (
echo Disabling %%i...
sc config %%i start= disabled 2>NUL
)
if %WHEN_TO_APPLY%==Now goto XP_32_aggressive_Now
goto end
:XP_32_aggressive_Now
:: This section runs after the profile above, if selected. It applies changes immediately.
echo Stopping the following services:
for %%i in (AppMgmt,Browser,COMSysApp,CryptSvc,dmadmin,dmserver,Dnscache,FastUserSwitchingCompatibility,ImapiService,lanmanserver,Nla,NtLmSsp,RpcLocator,SCardSvr,Schedule,seclogon,ShellHWDetection,Spooler,TapiSrv,TermService,TrkWks,wuauserv) do (
echo Stopping %%i...
net stop %%i 2>NUL
)
net stop EventSystem /y
If we executed this block then there's nothing left to do, so we go to the end. Yahtzee!
goto end
:Vista_32_menu_profile
:: This is where the user selects the lockdown profile to use. Pretty self-explanatory.
set WIN_VER=Windows Vista 32/64-bit
title Services Lockdown - %WIN_VER%
cls
echo.
echo WINDOWS SERVICES LOCKDOWN - STEP 2/3
echo.
echo Step 1: Choose OS: %WIN_VER%
echo Step 2: Choose Profile: %namePROFILE%
echo Step 3: Confirm
echo.
echo.
echo Select the lockdown profile to apply to 121 services
echo -----------------------------------------------------------------------
echo PROFILE Disabled On-demand Running Total
echo -----------------------------------------------------------------------
echo 1. Windows Defaults 4 64 53 121
echo 2. Minor 20 54 47 121
echo 3. Moderate (recommended) 52 35 34 121
echo 4. Aggressive 72 24 25 121
echo.
echo 5. Go back to Operating System choices
echo.
echo.
:Vista_32_menu_profileChoice
set /p choice=Choice:
if not '%choice%'=='' set choice=%Choice:~0,1%
if '%choice%'=='1' set PROFILE=Vista_32_default && set basePROFILE=Vista_32_default && set namePROFILE=Default && goto Vista_32_menu_confirm
if '%choice%'=='2' set PROFILE=Vista_32_minor && set basePROFILE=Vista_32_default && set namePROFILE=Minor && goto Vista_32_menu_confirm
if '%choice%'=='3' set PROFILE=Vista_32_moderate && set basePROFILE=Vista_32_moderate && set namePROFILE=Moderate && goto Vista_32_menu_confirm
if '%choice%'=='4' set PROFILE=Vista_32_aggressive && set basePROFILE=Vista_32_moderate && set namePROFILE=Aggressive && goto Vista_32_menu_confirm
if '%choice%'=='5' set WIN_VER=-- && echo. && cls && goto os_menu
:: Else, go back and re-draw the menu
echo.
echo "%choice%" is not valid, please try again
echo.
goto Vista_32_menu_profileChoice
:Vista_32_menu_confirm
:: Confirm the profile and execute
set WIN_VER=Windows Vista 32/64-bit
title Services Lockdown - %WIN_VER%
cls
echo.
echo WINDOWS SERVICES LOCKDOWN - STEP 3/3
echo.
echo Step 1: Choose OS: %WIN_VER%
echo Step 2: Choose Profile: %namePROFILE%
echo Step 3: Confirm
echo.
echo.
echo ABOUT TO APPLY THE %WIN_VER% "%namePROFILE%" CONFIGURATION!
echo.
echo.
echo CONFIRM?
echo.
echo 1. Yes - changes take effect immediately
echo 2. Yes - changes take effect at next reboot
echo.
echo 3. No, go back to profile selection
echo.
echo.
:Vista_32_menu_confirmChoice
set /p choice=Choice:
if not '%choice%'=='' set choice=%Choice:~0,1%
if '%choice%'=='1' set WHEN_TO_APPLY=Now && goto %basePROFILE%
if '%choice%'=='2' set WHEN_TO_APPLY=reboot && goto %basePROFILE%
if '%choice%'=='3' set namePROFILE=-- && goto Vista_32_menu_profile
echo.
echo "%choice%" is not valid, please try again
echo.
goto Vista_32_menu_confirmChoice
:Vista_32_default
:: Operating system defaults. Default also forms the base for the Minor profile.
cls
title Resetting to defaults...
echo.
echo Now resetting all services to the %WIN_VER% defaults, please wait...
echo.
echo Setting the following services to "Automatically start":
for %%i in (AeLookupSvc,AudioEndpointBuilder,AudioSrv,BFE,BITS,Browser,CryptSvc,CscService,Dhcp,Dnscache,ehstart,EMDMgmt,Eventlog,EventSystem,FDResPub,IKEEXT,iphlpsvc,KtmRm,LanmanServer,LanmanWorkstation,lmhosts,MMCSS,MpsSvc,netprofm,NlaSvc,nsi,PcaSvc,PlugPlay,PolicyAgent,ProfSvc,Schedule,seclogon,SENS,ShellHWDetection,slsvc,Spooler,SysMain,TabletInputService,TBS,TermService,Themes,upnphost,UxSms,W32Time,WebClient,WerSvc,WinDefend,Winmgmt,Wlansvc,WPDBusEnum,wscsvc,WSearch,wuauserv) do (
echo %%i...
sc config %%i start= auto 2>NUL
)
echo Setting the following services to "Automatic start (delayed)":
for %%i in (BITS,ehstart,KtmRm,TBS,wscsvc,wuauserv) do (
echo Disabling %%i...
sc config %%i start= delayed-auto
)
echo Setting the following services to "Only start on demand":
for %%i in (ALG,Appinfo,AppMgmt,CertPropSvc,clr_optimization_v2.0.50727_32,COMSysApp,DFSR,dot3svc,EapHost,ehRecvr,ehSched,Fax,fdPHost,FontCache3.0.0.0,hidserv,hkmsvc,idsvc,IPBusEnum,KeyIso,lltdsvc,MSDTC,MSiSCSI,msiserver,napage,t,Netlogon,Netman,p2pimsvc,p2psvc,pla,PNRPAutoReg,PNRPsvc,ProtectedStorage,QWAVE,RasAuto,RasMan,RemoteRegistry,RpcLocator,SCardSvr,SCPolicySvc,SDRSVC,SessionEnv,SLUINotify,SNMPTRAP,SSDPSRV,SstpSvc,stisvc,swprv,TapiSrv,THREADORDER,UI0Detect,UmRdpService,vds,VSS,wbengine,wcncsvc,WcsPlugInService,Wecsvc,wercplsupport,WinHttpAutoProxySvc,WinRM,wmiApSrv,WMPNetworkSvc,WPCSvc,wudfsvc) do (
echo %%i...
sc config %%i start= demand 2>NUL
)
echo Setting the following services to "Disabled":
for %%i in (Mcx2Svc,NetTcpPortSharing,RemoteAccess,SharedAccess) do (
echo Disabling %%i...
sc config %%i start= disabled 2>NUL
)
if %WHEN_TO_APPLY%==Now goto Vista_32_default_Now
if %PROFILE%==Vista_32_minor goto Vista_32_minor
goto end
:Vista_32_default_Now
:: This section runs after the Default profile, if selected. It applies changes immediately.
echo Starting the following services:
for %%i in (AeLookupSvc,AudioEndpointBuilder,AudioSrv,BFE,BITS,Browser,CryptSvc,CscService,Dhcp,Dnscache,ehstart,EMDMgmt,Eventlog,EventSystem,FDResPub,IKEEXT,iphlpsvc,KtmRm,LanmanServer,LanmanWorkstation,lmhosts,MMCSS,MpsSvc,Netlogon,netprofm,NlaSvc,nsi,PcaSvc,PlugPlay,PolicyAgent,ProfSvc,Schedule,seclogon,SENS,ShellHWDetection,slsvc,Spooler,SysMain,TabletInputService,TBS,TermService,Themes,upnphost,UxSms,W32Time,WebClient,WerSvc,WinDefend,Winmgmt,Wlansvc,WPDBusEnum,wscsvc,WSearch,wuauserv) do (
echo Starting %%i...
net start %%i 2>NUL
)
echo Stopping the following services:
for %%i in (ALG,Appinfo,AppMgmt,CertPropSvc,clr_optimization_v2.0.50727_32,COMSysApp,DFSR,dot3svc,EapHost,ehRecvr,ehSched,Fax,fdPHost,FontCache3.0.0.0,hidserv,hkmsvc,idsvc,IPBusEnum,KeyIso,lltdsvc,Mcx2Svc,MSDTC,MSiSCSI,msiserver,napagent,NetTcpPortSharing,p2pimsvc,p2psvc,pla,PNRPAutoReg,PNRPsvc,ProtectedStorage,QWAVE,RasAuto,RasMan,RemoteAccess,RemoteRegistry,RpcLocator,SCardSvr,SCPolicySvc,SDRSVC,SessionEnv,SharedAccess,SLUINotify,SNMPTRAP,SSDPSRV,SstpSvc,stisvc,swprv,TapiSrv,THREADORDER,UI0Detect,UmRdpService,vds,VSS,wbengine,wcncsvc,WcsPlugInService,Wecsvc,wercplsupport,WinHttpAutoProxySvc,WinRM,wmiApSrv,WMPNetworkSvc,WPCSvc,wudfsvc) do (
echo Stopping %%i...
net stop %%i 2>NUL
)
net stop netman /y
if %PROFILE%==Vista_32_minor goto Vista_32_minor
goto end
:Vista_32_minor
:: If it was selected, the Minor profile runs after Default as addendum.
cls
title Applying %PROFILE% settings...
echo.
echo Now applying %PROFILE% settings, please wait...
echo.
echo Setting the following services to "Disabled":
for %%i in (CertPropSvc,CscService,Fax,iphlpsvc,MSiSCSI,Netlogon,RemoteRegistry,SCardSvr,SCPolicySvc,SNMPTRAP,TabletInputService,UmRdpService,WebClient,WinHttpAutoProxySvc,WinRM,WSearch) do (
echo Disabling %%i...
sc config %%i start= disabled 2>NUL
)
sc config TBS start= demand
sc config TBS start= delayed-auto
if %WHEN_TO_APPLY%==Now goto Vista_32_minor_Now
goto end
:Vista_32_minor_Now
:: If it was selected, this section runs after the profile above. It applies changes immediately.
echo Stopping the following services:
for %%i in (CertPropSvc,Fax,iphlpsvc,MSiSCSI,Netlogon,CscService,RemoteRegistry,SCardSvr,SCPolicySvc,SNMPTRAP,TabletInputService,UmRdpService,TBS,WebClient,WinRM,WSearch,WinHttpAutoProxySvc) do (
echo Stopping %%i...
net stop %%i 2>NUL
)
If we executed this block then there's nothing left to do, so we go to the end. whew!
goto end
:Vista_32_moderate
:: The Moderate profile forms the base for the Aggressive profile
cls
title Applying %PROFILE% settings...
echo.
echo Now applying %PROFILE% settings, please wait...
echo.
echo Setting the following services to "Automatically start":
for %%i in (AudioEndpointBuilder,AudioSrv,BFE,BITS,CryptSvc,Dhcp,Dnscache,EMDMgmt,Eventlog,EventSystem,KtmRm,LanmanServer,LanmanWorkstation,MMCSS,MpsSvc,netprofm,NlaSvc,nsi,PcaSvc,PlugPlay,PolicyAgent,ProfSvc,Schedule,SENS,ShellHWDetection,slsvc,Spooler,SysMain,W32Time,WinDefend,Winmgmt,Wlansvc,wscsvc,wuauserv) do (
echo %%i...
sc config %%i start= auto 2>NUL
)
echo Setting the following services to "Automatic start (delayed)":
for %%i in (BITS,KtmRm,TBS,wscsvc,wuauserv) do (
echo Disabling %%i...
sc config %%i start= delayed-auto
)
echo Setting the following services to "Only start on demand":
for %%i in (ALG,Appinfo,AppMgmt,Browser,clr_optimization_v2.0.50727_32,COMSysApp,dot3svc,FontCache3.0.0.0,IKEEXT,KeyIso,msiserver,Netman,pla,ProtectedStorage,RasAuto,RasMan,RpcLocator,SDRSVC,seclogon,SessionEnv,SLUINotify,SSDPSRV,SstpSvc,swprv,TBS,TermService,THREADORDER,UI0Detect,upnphost,VSS,wbengine,WcsPlugInService,Wecsvc,wmiApSrv,wudfsvc) do (
echo %%i...
sc config %%i start= demand 2>NUL
)
echo Setting the following services to "Disabled":
for %%i in (AeLookupSvc,CertPropSvc,CscService,DFSR,EapHost,ehRecvr,ehSched,ehstart,Fax,fdPHost,FDResPub,hidserv,hkmsvc,idsvc,IPBusEnum,iphlpsvc,lltdsvc,lmhosts,Mcx2Svc,MSDTC,MSiSCSI,napagent,Netlogon,NetTcpPortSharing,p2pimsvc,p2psvc,PNRPAutoReg,PNRPsvc,QWAVE,RemoteAccess,RemoteRegistry,SCardSvr,SCPolicySvc,SharedAccess,SNMPTRAP,stisvc,TabletInputService,TapiSrv,Themes,UmRdpService,UxSms,vds,wcncsvc,WebClient,wercplsupport,WerSvc,WinHttpAutoProxySvc,WinRM,WMPNetworkSvc,WPCSvc,WPDBusEnum,WSearch) do (
echo Disabling %%i...
sc config %%i start= disabled 2>NUL
)
:: Moderate end
if %WHEN_TO_APPLY%==Now goto Vista_32_moderate_Now
if %PROFILE%==Vista_32_aggressive goto Vista_32_aggressive
goto end
:Vista_32_moderate_Now
:: This section runs after the profile above, if selected. It applies changes immediately.
echo Starting the following services:
for %%i in (AudioEndpointBuilder,AudioSrv,BFE,BITS,CryptSvc,Dhcp,Dnscache,EMDMgmt,Eventlog,EventSystem,KtmRm,LanmanServer,LanmanWorkstation,MMCSS,MpsSvc,netprofm,NlaSvc,nsi,PcaSvc,PlugPlay,PolicyAgent,ProfSvc,Schedule,SENS,ShellHWDetection,slsvc,Spooler,SysMain,W32Time,WinDefend,Winmgmt,Wlansvc,wscsvc,wuauserv) do (
echo Starting %%i...
net start %%i 2>NUL
)
echo Stopping the following services:
for %%i in (AeLookupSvc,ALG,Appinfo,AppMgmt,Browser,CertPropSvc,clr_optimization_v2.0.50727_32,COMSysApp,CscService,DFSR,dot3svc,EapHost,ehRecvr,ehSched,ehstart,Fax,fdPHost,FDResPub,FontCache3.0.0.0,hidserv,hkmsvc,idsvc,IKEEXT,IPBusEnum,iphlpsvc,KeyIso,lltdsvc,lmhosts,Mcx2Svc,MSDTC,MSiSCSI,msiserver,napagent,Netlogon,NetTcpPortSharing,p2pimsvc,p2psvc,pla,PNRPAutoReg,PNRPsvc,ProtectedStorage,QWAVE,RasAuto,RasMan,RemoteAccess,RemoteRegistry,RpcLocator,SCardSvr,SCPolicySvc,SDRSVC,seclogon,SessionEnv,SharedAccess,SLUINotify,SNMPTRAP,SSDPSRV,SstpSvc,stisvc,swprv,TabletInputService,TapiSrv,TBS,TermService,Themes,THREADORDER,UI0Detect,UmRdpService,upnphost,UxSms,vds,VSS,wbengine,wcncsvc,WcsPlugInService,WebClient,Wecsvc,wercplsupport,WerSvc,WinHttpAutoProxySvc,WinRM,wmiApSrv,WMPNetworkSvc,WPCSvc,WPDBusEnum,WSearch,wudfsvc) do (
echo Stopping %%i...
net stop %%i 2>NUL
)
net stop Netman /y
if %PROFILE%==Vista_32_aggressive goto Vista_32_aggressive
goto end
:Vista_32_aggressive
:: If it was selected, the Aggressive profile runs after the Moderate profile as an addendum.
cls
title Applying %PROFILE% settings...
echo.
echo Now applying %PROFILE% settings, please wait...
echo.
echo Now applying Aggressive profile...
echo Setting the following services to "Only start on demand":
for %%i in (PcaSvc,W32Time) do (
echo %%i...
sc config %%i start= demand 2>NUL
)
echo Setting the following services to "Disabled":
for %%i in (ALG,AppMgmt,BFE,clr_optimization_v2.0.50727_32,EMDMgmt,FontCache3.0.0.0,IKEEXT,KeyIso,KtmRm,pla,PolicyAgent,ShellHWDetection,swprv,TermService,UI0Detect,upnphost,wbengine,WcsPlugInService,WinDefend,wscsvc) do (
echo Disabling %%i...
sc config %%i start= disabled 2>NUL
)
if %WHEN_TO_APPLY%==Now goto Vista_32_aggressive_Now
goto end
:Vista_32_aggressive_Now
:: This section runs after the profile above, if selected. It applies changes immediately.
echo Stopping the following services:
for %%i in (ALG,AppMgmt,BFE,clr_optimization_v2.0.50727_32,EMDMgmt,FontCache3.0.0.0,IKEEXT,KeyIso,KtmRm,PcaSvc,pla,PolicyAgent,ShellHWDetection,swprv,TermService,UI0Detect,upnphost,W32Time,wbengine,WcsPlugInService,WinDefend,wscsvc) do (
echo Stopping %%i...
net stop %%i 2>NUL
)
If we executed this block then there's nothing left to do, so we go to the end. Yahtzee!
goto end
:7_32_menu_profile
:: This is where the user selects the lockdown profile to use. Pretty self-explanatory.
set WIN_VER=Windows 7 32/64-bit
title Services Lockdown - %WIN_VER%
cls
echo.
echo WINDOWS SERVICES LOCKDOWN - STEP 2/3
echo.
echo Step 1: Choose OS: %WIN_VER%
echo Step 2: Choose Profile: %namePROFILE%
echo Step 3: Confirm
echo.
echo.
echo Select the lockdown profile to apply to 136 services
echo -----------------------------------------------------------------------
echo PROFILE Disabled On-demand Running Total
echo -----------------------------------------------------------------------
echo 1. Windows Defaults 2 85 36 123
echo 2. Minor 18 72 34 124
echo 3. Moderate (recommended) 61 42 33 136
echo 4. Aggressive 82 32 24 138
echo.
echo 5. Go back to Operating System choices
echo.
echo.
:7_32_menu_profileChoice
set /p choice=Choice:
if not '%choice%'=='' set choice=%Choice:~0,1%
if '%choice%'=='1' set PROFILE=7_32_default && set basePROFILE=7_32_default && set namePROFILE=Default&& goto 7_32_menu_confirm
if '%choice%'=='2' set PROFILE=7_32_minor && set basePROFILE=7_32_default && set namePROFILE=Minor&& goto 7_32_menu_confirm
if '%choice%'=='3' set PROFILE=7_32_moderate && set basePROFILE=7_32_moderate && set namePROFILE=Moderate&& goto 7_32_menu_confirm
if '%choice%'=='4' set PROFILE=7_32_aggressive && set basePROFILE=7_32_moderate && set namePROFILE=Aggressive&& goto 7_32_menu_confirm
if '%choice%'=='5' set WIN_VER=-- && echo. && cls && goto os_menu
:: Else, go back and re-draw the menu
echo.
echo "%choice%" is not valid, please try again
echo.
goto 7_32_menu_choice
:7_32_menu_confirm
:: Confirm the profile and execute
set WIN_VER=Windows 7 32/64-bit
title Services Lockdown - %WIN_VER%
cls
echo.
echo WINDOWS SERVICES LOCKDOWN - STEP 3/3
echo.
echo Step 1: Choose OS: %WIN_VER%
echo Step 2: Choose Profile: %namePROFILE%
echo Step 3: Confirm
echo.
echo.
echo ABOUT TO APPLY THE %WIN_VER% "%namePROFILE%" CONFIGURATION!
echo.
echo.
echo CONFIRM?
echo.
echo 1. Yes - changes take effect immediately
echo 2. Yes - changes take effect at next reboot
echo.
echo 3. No, go back to profile selection
echo.
echo.
:7_32_menu_confirmChoice
set /p choice=Choice:
if not '%choice%'=='' set choice=%Choice:~0,1%
if '%choice%'=='1' set WHEN_TO_APPLY=Now && goto %basePROFILE%
if '%choice%'=='2' set WHEN_TO_APPLY=reboot && goto %basePROFILE%
if '%choice%'=='3' set namePROFILE=-- && goto 7_32_menu_profile
echo.
echo "%choice%" is not valid, please try again
echo.
goto 7_32_menu_confirmChoice
:7_32_default
:: Operating system defaults. Default also forms the base for the Minor profile.
cls
title Resetting to defaults...
echo.
echo Now resetting all services to the %WIN_VER% defaults, please wait...
echo.
echo Setting the following services to "Automatically start":
for %%i in (AudioEndpointBuilder,AudioSrv,BDESVC,BFE,CryptSvc,CscService,Dhcp,Dnscache,Eventlog,EventSystem,FDResPub,iphlpsvc,LanmanServer,LanmanWorkstation,lmhosts,MMCSS,MpsSvc,NlaSvc,nsi,PlugPlay,Power,ProfSvc,RpcEptMapper,Schedule,SENS,ShellHWDetection,Spooler,sppsvc,SysMain,Themes,UxSms,WinDefend,Winmgmt,Wlansvc,wscsvc,wuauserv) do (
echo %%i...
sc config %%i start= auto 2>NUL
)
echo Setting the following services to "Automatic start (delayed)":
for %%i in (clr_optimization_v2.0.50727_32,sppsvc,WinDefend,wscsvc,wuauserv) do (
echo Disabling %%i...
sc config %%i start= delayed-auto
)
echo Setting the following services to "Only start on demand":
for %%i in (AeLookupSvc,ALG,AppIDSvc,Appinfo,AppMgmt,AxInstSV,BITS,Browser,bthserv,CertPropSvc,COMSysApp,defragsvc,dot3svc,EapHost,EFS,fdPHost,FontCache,hidserv,hkmsvc,HomeGroupListener,HomeGroupProvider,IKEEXT,IPBusEnum,KeyIso,KtmRm,lltdsvc,MSDTC,MSiSCSI,msiserver,napagent,Netlogon,Netman,netprofm,p2pimsvc,p2psvc,PcaSvc,PeerDistSvc,pla,PNRPAutoReg,PNRPsvc,PolicyAgent,ProtectedStorage,QWAVE,RasAuto,RasMan,RemoteRegistry,RpcLocator,SCardSvr,SCPolicySvc,SDRSVC,seclogon,SensrSvc,SNMPTRAP,sppuinotify,SSDPSRV,SstpSvc,StiSvc,swprv,TabletInputService,TapiSrv,TBS,TermService,THREADORDER,UI0Detect,UmRdpService,upnphost,VaultSvc,vds,VSS,W32Time,wbengine,WbioSrvc,wcncsvc,WcsPlugInService,WebClient,Wecsvc,wercplsupport,WerSvc,WinHttpAutoProxySvc,WinRM,wmiApSrv,WPCSvc,WPDBusEnum,wudfsvc,WwanSvc
) do (
echo %%i...
sc config %%i start= demand 2>NUL
)
echo Setting the following services to "Disabled":
for %%i in (RemoteAccess,SharedAccess) do (
echo Disabling %%i...
sc config %%i start= disabled 2>NUL
)
if %WHEN_TO_APPLY%==Now goto 7_32_default_Now
if %PROFILE%==7_32_minor goto 7_32_minor
goto end
:7_32_default_Now
:: This section runs after the profile above, if selected. It applies changes immediately.
echo Starting the following services:
for %%i in (AudioEndpointBuilder,AudioSrv,BDESVC,BFE,clr_optimization_v2.0.50727_32,CryptSvc,CscService,Dhcp,Dnscache,Eventlog,EventSystem,FDResPub,iphlpsvc,LanmanServer,LanmanWorkstation,lmhosts,MMCSS,MpsSvc,Netlogon,NlaSvc,nsi,PlugPlay,Power,ProfSvc,RpcEptMapper,Schedule,SENS,ShellHWDetection,Spooler,sppsvc,SysMain,Themes,UxSms,WinDefend,Winmgmt,Wlansvc,wscsvc,wuauserv) do (
echo Starting %%i...
net start %%i 2>NUL
)
echo Stopping the following services:
for %%i in (AeLookupSvc,ALG,AppIDSvc,Appinfo,AppMgmt,AxInstSV,BITS,Browser,bthserv,CertPropSvc,COMSysApp,defragsvc,dot3svc,EapHost,EFS,fdPHost,FontCache,hidserv,hkmsvc,HomeGroupListener,HomeGroupProvider,IKEEXT,IPBusEnum,KeyIso,KtmRm,lltdsvc,MSDTC,MSiSCSI,msiserver,napagent,netprofm,p2pimsvc,p2psvc,PcaSvc,PeerDistSvc,pla,PNRPAutoReg,PNRPsvc,PolicyAgent,ProtectedStorage,QWAVE,RasAuto,RasMan,RemoteAccess,RemoteRegistry,RpcLocator,SCardSvr,SCPolicySvc,SDRSVC,seclogon,SensrSvc,SharedAccess,SNMPTRAP,sppuinotify,SSDPSRV,SstpSvc,StiSvc,swprv,TabletInputService,TapiSrv,TBS,TermService,THREADORDER,UI0Detect,UmRdpService,upnphost,VaultSvc,vds,VSS,W32Time,wbengine,WbioSrvc,wcncsvc,WcsPlugInService,WebClient,Wecsvc,wercplsupport,WerSvc,WinHttpAutoProxySvc,WinRM,wmiApSrv,WPCSvc,WPDBusEnum,wudfsvc,WwanSvc
) do (
echo Stopping %%i...
net stop %%i 2>NUL
)
net stop Netman /y
if %PROFILE%==7_32_minor goto 7_32_minor
goto end
:7_32_minor
:: If it was selected, the Minor profile runs after Default as addendum.
cls
title Applying %PROFILE% settings...
echo.
echo Now applying %PROFILE% settings, please wait...
echo.
echo Setting the following services to "Disabled":
for %%i in (AppMgmt,bthserv,PeerDistSvc,CertPropSvc,iphlpsvc,MSiSCSI,Netlogon,napagent,CscService,WPCSvc,RpcLocator,RemoteRegistry,SCardSvr,SCPolicySvc,SNMPTRAP,wcncsvc) do (
echo Disabling %%i...
sc config %%i start= disabled 2>NUL
)
sc config clr_optimization_v2.0.50727_32 start= demand
if %WHEN_TO_APPLY%==Now goto 7_32_minor_Now
goto end
:7_32_minor_Now
:: If it was selected, this section runs after the profile above. It applies changes immediately.
echo Stopping the following services:
for %%i in (AppMgmt,bthserv,PeerDistSvc,CertPropSvc,iphlpsvc,clr_optimization_v2.0.50727_32,MSiSCSI,Netlogon,napagent,CscService,WPCSvc,RpcLocator,RemoteRegistry,SCardSvr,SCPolicySvc,SNMPTRAP,wcncsvc) do (
echo Stopping %%i...
net stop %%i 2>NUL
)
If we executed this block then there's nothing left to do, so we go to the end. Yahtzee!
goto end
:7_32_moderate
:: The Moderate profile forms the base for the Aggressive profile
cls
title Applying %PROFILE% settings...
echo.
echo Now applying %PROFILE% settings, please wait...
echo.
echo Setting the following services to "Automatically start":
for %%i in (AudioEndpointBuilder,AudioSrv,BDESVC,BFE,CryptSvc,Dhcp,Dnscache,Eventlog,EventSystem,LanmanServer,LanmanWorkstation,lmhosts,MMCSS,MpsSvc,NlaSvc,nsi,PlugPlay,Power,ProfSvc,RpcEptMapper,Schedule,SENS,ShellHWDetection,Spooler,sppsvc,SysMain,Themes,UxSms,WinDefend,Winmgmt,Wlansvc,wscsvc,wuauserv) do (
echo %%i...
sc config %%i start= auto 2>NUL
)
echo Setting the following services to "Automatic start (delayed)":
for %%i in (sppsvc,WinDefend,wscsvc,wuauserv) do (
echo Disabling %%i...
sc config %%i start= delayed-auto
)
echo Setting the following services to "Only start on demand":
for %%i in (AeLookupSvc,AppIDSvc,Appinfo,BITS,Browser,clr_optimization_v2.0.50727_32,COMSysApp,defragsvc,dot3svc,EapHost,FontCache,HomeGroupListener,HomeGroupProvider,IKEEXT,KeyIso,KtmRm,MSDTC,msiserver,Netman,netprofm,pla,PolicyAgent,ProtectedStorage,RasAuto,RasMan,SDRSVC,seclogon,sppuinotify,SSDPSRV,SstpSvc,StiSvc,swprv,TapiSrv,THREADORDER,upnphost,vds,VSS,W32Time,wbengine,Wecsvc,wmiApSrv,wudfsvc) do (
echo %%i...
sc config %%i start= demand 2>NUL
)
echo Setting the following services to "Disabled":
for %%i in (ALG,AppMgmt,AxInstSV,bthserv,CertPropSvc,CscService,Dps,EFS,ehRecvr,ehSched,fdPHost,FDResPub,hidserv,hkmsvc,idsvc,IPBusEnum,iphlp,vc,lltdsvc,MSiSCSI,napagent,Netlogon,p2pimsvc,p2psvc,PcaSvc,PeerDistSvc,PNRPAutoReg,PNRPsvc,QWAVE,RemoteAccess,RemoteRegistry,RpcLocator,SCardSvr,SCPolicySvc,SensrSvc,SessionEnv,SharedAccess,ShellHWDetection,SNMPTRAP,StorSvc,TabletInputService,TBS,TermService,TrkWks,UI0Detect,UmRdpService,VaultSvc,WbioSrvc,wcncsvc,WcsPlugInService,WdiServiceHost,WdiSystemHost,WebClient,wercplsupport,WerSvc,WinHttpAutoProxySvc,WinRM,WPCSvc,WPDBusEnum,WwanSvc,Wsearch,WMPNetworkSvc
) do (
echo Disabling %%i...
sc config %%i start= disabled 2>NUL
)
:: Test if we are also applying the Aggressive profile
if %WHEN_TO_APPLY%==Now goto 7_32_moderate_Now
if %PROFILE%==7_32_aggressive goto 7_32_aggressive
goto end
:7_32_moderate_Now
:: This section runs after the profile above, if selected. It applies changes immediately.
echo Starting the following services:
for %%i in (AudioEndpointBuilder,AudioSrv,BDESVC,BFE,clr_optimization_v2.0.50727_32,CryptSvc,Dhcp,Dnscache,Eventlog,EventSystem,LanmanServer,LanmanWorkstation,lmhosts,MMCSS,MpsSvc,NlaSvc,nsi,PlugPlay,Power,ProfSvc,RpcEptMapper,Schedule,SENS,ShellHWDetection,Spooler,sppsvc,SysMain,Themes,UxSms,WinDefend,Winmgmt,Wlansvc,wscsvc,wuauserv) do (
echo Starting %%i...
net start %%i 2>NUL
)
echo Stopping the following services:
for %%i in (AeLookupSvc,ALG,AppIDSvc,Appinfo,AppMgmt,AxInstSV,BITS,Browser,bthserv,CertPropSvc,COMSysApp,CscService,defragsvc,dot3svc,DPS,EapHost,EFS,ehRecvr,ehSched,fdPHost,FDResPub,FontCache,hidserv,hkmsvc,HomeGroupListener,HomeGroupProvider,idsvc,IKEEXT,IPBusEnum,iphlpsvc,KeyIso,KtmRm,lltdsvc,MSDTC,MSiSCSI,msiserver,napagent,Netlogon,netprofm,p2pimsvc,p2psvc,PcaSvc,PeerDistSvc,pla,PNRPAutoReg,PNRPsvc,PolicyAgent,ProtectedStorage,QWAVE,RasAuto,RasMan,RemoteAccess,RemoteRegistry,RpcLocator,SCardSvr,SCPolicySvc,SDRSVC,seclogon,SensrSvc,SessionEnv,SharedAccess,ShellHWDetection,SNMPTRAP,sppuinotify,SSDPSRV,SstpSvc,StiSvc,StorSvc,swprv,TabletInputService,TapiSrv,TBS,TermService,THREADORDER,TrkWks,UI0Detect,UmRdpService,upnphost,VaultSvc,vds,VSS,W32Time,wbengine,WbioSrvc,wcncsvc,WcsPlugInService,WdiServiceHost,WdiSystemHost,WebClient,Wecsvc,wercplsupport,WerSvc,WinHttpAutoProxySvc,WinRM,wmiApSrv,WMPNetworkSvc,WPCSvc,WPDBusEnum,WSearch,wudfsvc,WwanSvc) do (
echo Stopping %%i...
net stop %%i 2>NUL
)
net stop Netman /y
if %PROFILE%==7_32_aggressive goto 7_32_aggressive
goto end
:7_32_aggressive
:: If it was selected, the Aggressive profile runs after the Moderate profile as an addendum.
cls
title Applying %PROFILE% settings...
echo.
echo Now applying %PROFILE% settings, please wait...
echo.
echo Setting the following services to "Disabled":
for %%i in (BITS,BFE,BDESVC,wbengine,KeyIso,UxSms,Dnscache,EapHost,HomeGroupListener,HomeGroupProvider,PolicyAgent,SstpSvc,wscsvc,lmhosts,TapiSrv,Themes,WinDefend,W32Time,dot3svc) do (
echo Disabling %%i...
sc config %%i start= disabled 2>NUL
)
sc config wuauserv start= demand
:: These services were missing from the config tool and manually added by me
sc config NetTcpPortSharing start= disabled 2>NUL
sc config RpcLocator start= disabled 2>NUL
:: This is another service from our lovely Media Center edition. Goodbye.
REM Windows Presentation Foundation Font
sc config FontCache3.0.0.0 start= disabled 2>NUL
if %WHEN_TO_APPLY%==Now goto 7_32_aggressive_Now
goto end
:7_32_aggressive_Now
echo Stopping the following services:
for %%i in (BITS,BFE,BDESVC,wbengine,KeyIso,UxSms,Dnscache,EapHost,HomeGroupListener,HomeGroupProvider,PolicyAgent,SstpSvc,wscsvc,lmhosts,TapiSrv,Themes,WinDefend,W32Time,wuauserv,dot3svc,NetTcpPortSharing,RpcLocator,FontCache3.0.0.0) do (
echo Stopping %%i...
net stop %%i 2>NUL
)
::If we executed this block then there's nothing left to do, so we go to the end. Yahtzee!
goto end
::::::::::::::::::::::::::::::::::
:: ::
:: Beginning of 64-bit Sections ::
:: ::
::::::::::::::::::::::::::::::::::