-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathZeroLatency.ps1
More file actions
2288 lines (2040 loc) · 99.8 KB
/
Copy pathZeroLatency.ps1
File metadata and controls
2288 lines (2040 loc) · 99.8 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
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
# Request administrative privileges
if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Start-Process -FilePath "pwsh.exe" -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs
exit
}
# Writes all output to a .log file in the same directory as the script
Start-Transcript -Path (Join-Path -Path $PSScriptRoot -ChildPath "ZeroLatency.log") -Append
#########################################################
# BEGIN - Start modifying
#########################################################
#########################################################
# STEP 1 - Variables to modify (system)
$HAGS = 0 # Hardware Accelerated GPU Sched. 0 = Off, 1 = On
$GameMode = 1 # Windows Game Mode 0 = Off, 1 = On
$Pagefile = 16384 # Pagefile (Virtual Memory) X = Fixed size in MB (e.g., 16384 for 16GB)
$Win32PrioSep = 36 # Win32PrioritySeparation X = Decimal value to set the priority scheduling, which controls how the system distributes CPU time between foreground and background processes
# * F.B. = Foreground Boost
# Short Quantum, Fixed Policy
# - 42 Dec = 2A Hex → F.B. High
# - 41 Dec = 29 Hex → F.B. Medium
# - 40 Dec = 28 Hex → F.B. None
# Short Quantum, Variable Policy
# - 38 Dec = 26 Hex → F.B. High
# - 37 Dec = 25 Hex → F.B. Medium
# - 36 Dec = 24 Hex → F.B. None
# Long Quantum, Fixed Policy
# - 26 Dec = 1A Hex → F.B. High
# - 25 Dec = 19 Hex → F.B. Medium
# - 24 Dec = 18 Hex → F.B. None
# Long Quantum, Variable Policy
# - 22 Dec = 16 Hex → F.B. High
# - 21 Dec = 15 Hex → F.B. Medium
# - 20 Dec = 14 Hex → F.B. None
# References
# - https://youtu.be/bqDMG1ZS-Yw
# - https://youtu.be/5MF8XjDdr64
# STEP 1 - Variables to modify (network)
$Bandwidth = 500 # Bandwidth in Megabits per Sec. X = Value of your internet connection speed (e.g., 500 for 500Mbps or 1000 for 1Gbps)
$SQMRouter = 0 # Smart Queue Management Router 0 = No, 1 = Yes (Used to configure Congestion Control Provider and ECN Capability)
$AutoTuning = 0 # TCP Auto-Tuning Level 0 = Off, 1 = Normal, 2 = Restricted, 3 = HighlyRestricted, 4 = Experimental (With SQM: try 1, 2, 3)
$DNSProvider = 1 # Domain Name System Provider 0 = Auto (DHCP), 1 = Cloudflare, 2 = Google, 3 = OpenDNS, 4 = NextDNS, 5 = Quad9, 6 = AdGuard, 7 = ControlD, 8 = Gcore
$NICBrand = 1 # Network Interface Card Brand 1 = Realtek, 2 = Intel
$RBuffers = 32 # Receive Buffers 32 = Min, 4096 = Max (Increments of 8; may vary by NIC)
$TBuffers = 64 # Transmit Buffers 64 = Min, 4096 = Max (Increments of 8; may vary by NIC)
$Offloads = 3 # Checksum Offloads 0 = Off, 1 = Tx only, 2 = Rx only, 3 = Both
$RSSQueues = 4 # Number of RSS Queues 0 = Off, X = Number of RSS Queues (Available values: 1, 2, 4; may vary by NIC)
$RSSCore = 4 # Core to start assigning Queues X = Physical core (e.g., 0, 2, 4, 6... with HT/SMT on; 0, 1, 2, 3... otherwise), -1 = Assign from last core backwards
#########################################################
#########################################################
# STEP 2 - Add or remove folders to be excluded from Windows Defender Scan
$ExcludedFolders = @(
"C:\Games"
"C:\ProgramData"
"$env:UserProfile\AppData"
"$env:SystemRoot\System32\config\systemprofile\AppData"
"$env:SystemRoot\Temp"
)
#########################################################
#########################################################
# STEP 3 - Add or remove processes to be excluded from Windows Defender Scan and Exploit Protection
$ExcludedProcesses = @(
# System
"audiodg.exe"
"csrss.exe"
"ctfmon.exe"
"dwm.exe"
"smss.exe"
# Drivers
"nvcontainer.exe"
"nvdisplay.container.exe"
"razerappengine.exe"
"rzenginemon.exe"
# Tools
"bitsumsessionagent.exe"
"latmon.exe"
"mousetester.exe"
"msiafterburner.exe"
"presentmondataprovider.exe"
"processgovernor.exe"
"processlasso.exe"
"rtss.exe"
"rtsshooksloader64.exe"
# Steam
"cs2.exe"
"pathofexile_x64steam.exe"
"pathofexilesteam.exe"
"steam.exe"
"steamservice.exe"
"steamwebhelper.exe"
# Riot
"riotclientservices.exe"
"valorant-win64-shipping.exe"
"vgc.exe"
)
#########################################################
#########################################################
# STEP 4 - Add or remove services to be disabled
$DisabledServices = @(
"ADPSvc" # ADPSvc
"ALG" # Application Layer Gateway Service
"ApxSvc" # Windows Virtual Audio Device Proxy Service
"autotimesvc" # Cellular Time
"AxInstSV" # ActiveX Installer (AxInstSV)
"BDESVC" # BitLocker Drive Encryption Service
"BTAGService" # Bluetooth Audio Gateway Service
"BthAvctpSvc" # AVCTP service
"bthserv" # Bluetooth Support Service
"CertPropSvc" # Certificate Propagation
"dcsvc" # Declared Configuration(DC) service
"DeviceAssociationService" # Device Association Service
"DevQueryBroker" # DevQuery Background Discovery Broker
"diagsvc" # Diagnostic Execution Service
"DiagTrack" # Connected User Experiences and Telemetry
"DisplayEnhancementService" # Display Enhancement Service
"DmEnrollmentSvc" # Device Management Enrollment Service
"dmwappushservice" # Device Management Wireless Application Protocol (WAP) Push message Routing Service
"dot3svc" # Wired AutoConfig
"DPS" # Diagnostic Policy Service
"DsSvc" # Data Sharing Service
"DusmSvc" # Data Usage
"EapHost" # Extensible Authentication Protocol
"edgeupdate" # Microsoft Edge Update Service (edgeupdate)
"edgeupdatem" # Microsoft Edge Update Service (edgeupdatem)
"EFS" # Encrypting File System (EFS)
"fdPHost" # Function Discovery Provider Host
"FDResPub" # Function Discovery Resource Publication
"fhsvc" # File History Service
"GameInputSvc" # GameInput Service
"GraphicsPerfSvc" # GraphicsPerfSvc
"hidserv" # Human Interface Device Service
"icssvc" # Windows Mobile Hotspot Service
"InventorySvc" # Inventory and Compatibility Appraisal service
"iphlpsvc" # IP Helper
"IpxlatCfgSvc" # IP Translation Configuration Service
"lltdsvc" # Link-Layer Topology Discovery Mapper
"lmhosts" # TCP/IP NetBIOS Helper
"LxpSvc" # Language Experience Service
"MapsBroker" # Downloaded Maps Manager
"McmSvc" # This service provides profile management for mobile connectivity modules
"McpManagementService" # McpManagementService
"MicrosoftEdgeElevationService" # Microsoft Edge Elevation Service (MicrosoftEdgeElevationService)
"MSDTC" # Distributed Transaction Coordinator
"MSiSCSI" # Microsoft iSCSI Initiator Service
"NaturalAuthentication" # Natural Authentication
"NcaSvc" # Network Connectivity Assistant
"NcdAutoSetup" # Network Connected Devices Auto-Setup
"Netlogon" # Netlogon
"PcaSvc" # Program Compatibility Assistant Service
"perceptionsimulation" # Windows Perception Simulation Service
"PhoneSvc" # Phone Service
"pla" # Performance Logs & Alerts
"PrintDeviceConfigurationService" # Print Device Configuration Service
"PrintNotify" # Printer Extensions and Notifications
"PrintScanBrokerService" # PrintScanBrokerService
"QWAVE" # Quality Windows Audio Video Experience
"RasAuto" # Remote Access Auto Connection Manager
"RasMan" # Remote Access Connection Manager
"refsdedupsvc" # ReFS Dedup Service
"RemoteAccess" # Routing and Remote Access
"RemoteRegistry" # Remote Registry
"RetailDemo" # Retail Demo Service
"RmSvc" # Radio Management Service
"RpcLocator" # Remote Procedure Call (RPC) Locator
"SCardSvr" # Smart Card
"ScDeviceEnum" # Smart Card Device Enumeration Service
"SCPolicySvc" # Smart Card Removal Policy
"SDRSVC" # Windows Backup
"seclogon" # Secondary Logon
"SEMgrSvc" # Payments and NFC/SE Manager
"SensorDataService" # Sensor Data Service
"SensrSvc" # Sensor Monitoring Service
"SessionEnv" # Remote Desktop Configuration
"shpamsvc" # Shared PC Account Manager
"smphost" # Microsoft Storage Spaces SMP
"SmsRouter" # Microsoft Windows SMS Router Service.
"SNMPTrap" # SNMP Trap
"Spooler" # Print Spooler
"SSDPSRV" # SSDP Discovery
"ssh-agent" # OpenSSH Authentication Agent
"SstpSvc" # Secure Socket Tunneling Protocol Service
"svsvc" # Spot Verifier
"SysMain" # SysMain
"TapiSrv" # Telephony
"TermService" # Remote Desktop Services
"TieringEngineService" # Storage Tiers Management
"TrkWks" # Distributed Link Tracking Client
"TroubleshootingSvc" # Recommended Troubleshooting Service
"tzautoupdate" # Auto Time Zone Updater
"UmRdpService" # Remote Desktop Services UserMode Port Redirector
"upnphost" # UPnP Device Host
"WalletService" # WalletService
"WarpJITSvc" # Warp JIT Service
"wbengine" # Block Level Backup Engine Service
"WbioSrvc" # Windows Biometric Service
"wcncsvc" # Windows Connect Now - Config Registrar
"WebClient" # WebClient
"Wecsvc" # Windows Event Collector
"WEPHOSTSVC" # Windows Encryption Provider Host Service
"wercplsupport" # Problem Reports Control Panel Support
"WerSvc" # Windows Error Reporting Service
"WFDSConMgrSvc" # Wi-Fi Direct Services Connection Manager Service
"whesvc" # Windows Health and Optimized Experiences
"WiaRpc" # Still Image Acquisition Events
"WinRM" # Windows Remote Management (WS-Management)
"wisvc" # Windows Insider Service
"WlanSvc" # WLAN AutoConfig
"wlpasvc" # Local Profile Assistant Service
"WManSvc" # Windows Management Service
"wmiApSrv" # WMI Performance Adapter
"WMPNetworkSvc" # Windows Media Player Network Sharing Service
"WpcMonSvc" # Parental Controls
"WPDBusEnum" # Portable Device Enumerator Service
"WSAIFabricSvc" # WSAIFabricSvc
"WSearch" # Windows Search
"WwanSvc" # WWAN AutoConfig
"XblAuthManager" # Xbox Live Auth Manager
"XblGameSave" # Xbox Live Game Save
"XboxGipSvc" # Xbox Accessory Management Service
"XboxNetApiSvc" # Xbox Live Networking Service
)
#########################################################
#########################################################
# STEP 5 - Add or remove packages and apps to be uninstalled (ref: https://github.com/Raphire/Win11Debloat/blob/master/Apps.json)
$UninstalledPackages = @(
"Clipchamp.Clipchamp" # Video editor from Microsoft
"Microsoft.3DBuilder" # Basic 3D modeling software
"Microsoft.549981C3F5F10" # Cortana app (Voice assistant)
"Microsoft.BingFinance" # Finance news and tracking via Bing (Discontinued)
"Microsoft.BingFoodAndDrink" # Recipes and food news via Bing (Discontinued)
"Microsoft.BingHealthAndFitness" # Health and fitness tracking/news via Bing (Discontinued)
"Microsoft.BingNews" # News aggregator via Bing (Replaced by Microsoft News/Start)
"Microsoft.BingSearch" # Web Search from Microsoft Bing (Integrates into Windows Search)
"Microsoft.BingSports" # Sports news and scores via Bing (Discontinued)
"Microsoft.BingTranslator" # Translation service via Bing
"Microsoft.BingTravel" # Travel planning and news via Bing (Discontinued)
"Microsoft.BingWeather" # Weather forecast via Bing
"Microsoft.Copilot" # AI assistant integrated into Windows
"Microsoft.Edge" # Edge browser (Can only be uninstalled in European Economic Area)
"Microsoft.GamingApp" # Modern Xbox Gaming App, required for installing some PC games
"Microsoft.GetHelp" # Required for some Windows 11 Troubleshooters and support interactions
"Microsoft.Getstarted" # Tips and introductory guide for Windows (Cannot be uninstalled in Windows 11)
"Microsoft.M365Companions" # Microsoft 365 mini-apps
"Microsoft.Messaging" # Messaging app, often integrates with Skype (Largely deprecated)
"Microsoft.Microsoft3DViewer" # Viewer for 3D models
"Microsoft.MicrosoftJournal" # Digital note-taking app optimized for pen input
"Microsoft.MicrosoftOfficeHub" # Hub to access Microsoft Office apps and documents (Precursor to Microsoft 365 app)
"Microsoft.MicrosoftPowerBIForWindows" # Business analytics service client
"Microsoft.MicrosoftSolitaireCollection" # Collection of solitaire card games
"Microsoft.MicrosoftStickyNotes" # Digital sticky notes app
"Microsoft.MixedReality.Portal" # Portal for Windows Mixed Reality headsets
"Microsoft.NetworkSpeedTest" # Internet connection speed test utility
"Microsoft.News" # News aggregator (Replaced Bing News, now part of Microsoft Start)
"Microsoft.Office.OneNote" # Digital note-taking app (Universal Windows Platform version)
"Microsoft.Office.Sway" # Presentation and storytelling app
"Microsoft.OneConnect" # Mobile Operator management app (Replaced by Mobile Plans)
"Microsoft.OutlookForWindows" # New mail app: Outlook for Windows
"Microsoft.People" # Required for & included with Mail & Calendar (Contacts management)
"Microsoft.PowerAutomateDesktop" # Desktop automation tool (RPA)
"Microsoft.Print3D" # 3D printing preparation software
"Microsoft.RemoteDesktop" # Remote Desktop client app
"Microsoft.SkypeApp" # Skype communication app (Universal Windows Platform version)
"Microsoft.StartExperiencesApp" # This app powers Windows Widgets My Feed
"Microsoft.Todos" # To-do list and task management app
"Microsoft.Whiteboard" # Digital collaborative whiteboard app
"Microsoft.WindowsAlarms" # Alarms & Clock app
"Microsoft.windowscommunicationsapps" # Mail & Calendar app suite
"Microsoft.WindowsFeedbackHub" # App for providing feedback to Microsoft on Windows
"Microsoft.WindowsMaps" # Mapping and navigation app
"Microsoft.WindowsSoundRecorder" # Basic audio recording app
"Microsoft.Xbox.TCUI" # UI framework, seems to be required for MS store, photos and certain games
"Microsoft.XboxApp" # Old Xbox Console Companion App, no longer supported
"Microsoft.XboxGameOverlay" # Game overlay, required/useful for some games (Part of Xbox Game Bar)
"Microsoft.XboxGamingOverlay" # Game overlay, required/useful for some games (Part of Xbox Game Bar)
"Microsoft.XboxIdentityProvider" # Xbox sign-in framework, required for some games and Xbox services
"Microsoft.XboxSpeechToTextOverlay" # Might be required for some games, WARNING: This app cannot be reinstalled easily! (Accessibility feature)
"Microsoft.YourPhone" # Phone link (Connects Android/iOS phone to PC)
"Microsoft.ZuneMusic" # Modern Media Player (Replaced Groove Music, plays local audio/video)
"Microsoft.ZuneVideo" # Movies & TV app for renting/buying/playing video content (Rebranded as "Films & TV")
"MicrosoftCorporationII.MicrosoftFamily" # Family Safety App for managing family accounts and settings
"MicrosoftCorporationII.QuickAssist" # Remote assistance tool
"MicrosoftTeams" # Old MS Teams personal (MS Store version)
"MicrosoftWindows.CrossDevice" # Phone integration within File Explorer, Camera and more (Part of Phone Link features)
"MSTeams" # New MS Teams app (Work/School or Personal)
#####################################################
"ACGMediaPlayer" # Media player app
"ActiproSoftwareLLC" # Potentially UI controls or software components, often bundled by OEMs
"AdobeSystemsIncorporated.AdobePhotoshopExpress" # Basic photo editing app from Adobe
"Amazon.com.Amazon" # Amazon shopping app
"AmazonVideo.PrimeVideo" # Amazon Prime Video streaming service app
"Asphalt8Airborne" # Racing game
"AutodeskSketchBook" # Digital drawing and sketching app
"CaesarsSlotsFreeCasino" # Casino slot machine game
"COOKINGFEVER" # Restaurant simulation game
"CyberLinkMediaSuiteEssentials" # Multimedia software suite (often preinstalled by OEMs)
"Disney" # General Disney content app (may vary by region/OEM, often Disney+)
"DisneyMagicKingdoms" # Disney theme park building game
"DrawboardPDF" # PDF viewing and annotation app, often focused on pen input
"Duolingo-LearnLanguagesforFree" # Language learning app
"EclipseManager" # Often related to specific OEM software or utilities (e.g., for managing screen settings)
"Facebook" # Facebook social media app
"FarmVille2CountryEscape" # Farming simulation game
"fitbit" # Fitbit activity tracker companion app
"Flipboard" # News and social network aggregator styled as a magazine
"HiddenCity" # Hidden object puzzle adventure game
"HULULLC.HULUPLUS" # Hulu streaming service app
"iHeartRadio" # Internet radio streaming app
"Instagram" # Instagram social media app
"king.com.BubbleWitch3Saga" # Puzzle game from King
"king.com.CandyCrushSaga" # Puzzle game from King
"king.com.CandyCrushSodaSaga" # Puzzle game from King
"LinkedInforWindows" # LinkedIn professional networking app
"MarchofEmpires" # Strategy game
"Netflix" # Netflix streaming service app
"NYTCrossword" # New York Times crossword puzzle app
"OneCalendar" # Calendar aggregation app
"PandoraMediaInc" # Pandora music streaming app
"PhototasticCollage" # Photo collage creation app
"PicsArt-PhotoStudio" # Photo editing and creative app
"Plex" # Media server and player app
"PolarrPhotoEditorAcademicEdition" # Photo editing app (Academic Edition)
"Royal Revolt" # Tower defense / strategy game
"Shazam" # Music identification app
"Sidia.LiveWallpaper" # Live wallpaper app
"SlingTV" # Live TV streaming service app
"TikTok" # TikTok short-form video app
"TuneInRadio" # Internet radio streaming app
"Twitter" # Twitter (now X) social media app
"Viber" # Messaging and calling app
"WinZipUniversal" # File compression and extraction utility (Universal Windows Platform version)
"Wunderlist" # To-do list app (Acquired by Microsoft, functionality moved to Microsoft To Do)
"XING" # Professional networking platform popular in German-speaking countries
"Yousician" # Music learning app
)
#########################################################
#########################################################
# END - Stop modifying
#########################################################
# Exploit Protections to be disabled
$ExploitProtections = @(
"AllowStoreSignedBinaries"
"AllowThreadsToOptOut"
"AuditChildProcess"
"AuditDynamicCode"
"AuditEnableExportAddressFilter"
"AuditEnableExportAddressFilterPlus"
"AuditEnableImportAddressFilter"
"AuditEnableRopCallerCheck"
"AuditEnableRopSimExec"
"AuditEnableRopStackPivot"
"AuditFont"
"AuditLowLabelImageLoads"
"AuditMicrosoftSigned"
"AuditPreferSystem32"
"AuditRemoteImageLoads"
"AuditSEHOP"
"AuditStoreSigned"
"AuditSystemCall"
"AuditUserShadowStack"
"BlockDynamicCode"
"BlockLowLabelImageLoads"
"BlockRemoteImageLoads"
"BottomUp"
"CFG"
"DEP"
"DisableExtensionPoints"
"DisableFsctlSystemCalls"
"DisableNonSystemFonts"
"DisableWin32kSystemCalls"
"DisallowChildProcessCreation"
"EmulateAtlThunks"
"EnableExportAddressFilter"
"EnableExportAddressFilterPlus"
"EnableImportAddressFilter"
"EnableRopCallerCheck"
"EnableRopSimExec"
"EnableRopStackPivot"
"EnforceModuleDependencySigning"
"ForceRelocateImages"
"HighEntropy"
"MicrosoftSignedOnly"
"PreferSystem32"
"RequireInfo"
"SEHOP"
"SEHOPTelemetry"
"StrictCFG"
"StrictHandle"
"SuppressExports"
"TerminateOnError"
"UserShadowStack"
"UserShadowStackStrictMode"
)
# Optional features to be disabled
$OptionalFeatures = @(
"Client-ProjFS"
"DirectPlay"
"IIS-*"
"LegacyComponents"
"Microsoft-RemoteDesktopConnection"
"MSMQ-*"
"MSRDC-Infrastructure"
"NetFx3"
"Printing-Foundation-*"
"Printing-XPSServices-*"
"Recall"
"SearchEngine-Client-Package"
"SimpleTCP"
"SMB1*"
"TelnetClient"
"TFTP"
"TIFFIFilter"
"WAS-*"
"WCF-*"
"Windows-Identity-Foundation"
"WorkFolders-Client"
)
# Functions
function Invoke-Custom {
param([string]$Command)
Write-Host "`n`e[0;36m==> `e[1;36m$Command`e[0m"
Invoke-Expression $Command
}
function Write-Custom {
param([string]$Text)
Write-Host "`n`e[0;34m==> `e[1;34m$Text`e[0m"
}
function New-Task {
param ([string]$Name, [string]$Command)
$Argument = "-NoProfile -ExecutionPolicy Bypass -Command `"& { $Command }`""
$Action = New-ScheduledTaskAction -Execute "pwsh" -Argument $Argument
$Trigger = New-ScheduledTaskTrigger -AtStartup
$Principal = New-ScheduledTaskPrincipal -UserId "SYSTEM" -RunLevel Highest
Unregister-ScheduledTask -TaskName $Name -Confirm:$False -ErrorAction SilentlyContinue
Register-ScheduledTask -TaskName $Name -Action $Action -Trigger $Trigger -Principal $Principal -Force | Out-Null
Start-ScheduledTask -TaskName $Name
}
function Split-Registry {
param ([string]$Content)
$Pattern = "^\[.*\]$"
$Lines = $Content -split "`r?`n" | ForEach-Object { $_.Trim() } | Where-Object { $_ -ne "" }
$Paths = $Lines | Where-Object { $_ -match $Pattern }
$Entries = $Lines | Where-Object { $_ -notmatch $Pattern }
return ($Paths | ForEach-Object { @($_) + $Entries -join "`n" }) -join "`n`n"
}
function Set-Registry {
param ([string]$Content)
$TempFile = [System.IO.Path]::GetTempFileName() + ".reg"
$Content | Out-File "$TempFile" -Encoding ASCII
reg import "$TempFile" > $Null 2>&1
Remove-Item "$TempFile" -Force
}
function Get-RSSCommand {
param([int]$RSSQueues, [int]$RSSCore, [int]$NumCores)
$Limit = $NumCores * 2 - 2
if ($RSSCore -eq -1) {
$Base = $NumCores * 2 - $RSSQueues * 2
$Max = $Limit
} else {
$Base = $Max = $RSSCore
if ($RSSQueues -gt 0) { $Max += ($RSSQueues - 1) * 2 }
}
return "Set-NetAdapterRss -Profile 'ClosestStatic' -NumberOfReceiveQueues $([Math]::Max(1, $RSSQueues)) -BaseProcessorNumber $([Math]::Min($Base, $Limit)) -MaxProcessorNumber $([Math]::Min($Max, $Limit)) -Enabled `$$($RSSQueues -gt 0)"
}
# Suppress progress bars
$ProgressPreference = "SilentlyContinue"
# Number of *physical* cores of the CPU (e.g., 6 for a 6C/12T model)
$NumCores = (Get-CimInstance Win32_Processor | Measure-Object -Property NumberOfCores -Sum).Sum
# Test targets for measuring RTT and MTU
$Targets = @(
"fast.com"
"github.com"
"download.microsoft.com"
"1.1.1.1"
"8.8.8.8"
"208.67.222.222"
"45.90.28.0"
"9.9.9.9"
"94.140.14.14"
)
# Round Trip Time (In milliseconds, Average measured latency)
$RTT = $Targets | Select-Object -First 6 | ForEach-Object {
Test-Connection $_ -Count 3 -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Latency
} | Measure-Object -Average | ForEach-Object { [math]::Round($_.Average) }
if ($null -eq $RTT) { throw "RTT discovery failed!" }
Write-Custom "Successfully discovered RTT: $RTT ms"
# Maximum Transmission Unit (Common values: 1500 for Ethernet, 1492 for PPPoE, 1472 for VPN)
$MTU = $Targets | Select-Object -Last 6 | ForEach-Object {
$Min, $Max = 576, 1500
while ($Max - $Min -gt 1) {
$MTU = ($Min + $Max) -shr 1
if ((Get-CimInstance Win32_PingStatus -Filter "Address='$_' and BufferSize=$($MTU-28) and NoFragmentation=true").StatusCode -eq 0) {
$Min = $MTU
} else {
$Max = $MTU
}
}
$Min
} | Measure-Object -Minimum | Select-Object -ExpandProperty Minimum | ForEach-Object { [int]$_ }
if ($null -eq $MTU) { throw "MTU discovery failed!" }
Write-Custom "Successfully discovered MTU: $MTU bytes"
# Maximum Segment Size (MTU minus 40 bytes for TCP/IP header)
$MSS = $MTU - 40
# Bandwidth Delay Product (Bandwidth * Round Trip Time * Safety Factor)
$BDP = ($Bandwidth * 1000000 / 8) * ($RTT / 1000) * 1.5
# TCP Window Size (Rounded up to the nearest clean multiple of MSS)
$TWS = [math]::Ceiling($BDP / $MSS) * $MSS
# Advanced network settings
$CCProvider = 1 # Congestion Control Provider 1 = BBR2, 2 = CTCP, 3 = CUBIC
$PacProfile = 2 # Pacing Profile 0 = Off, 1 = Default, 2 = Initial Window, 3 = Slow Start, 4 = Always
$TCPOptions = 3 # TCP Options 0 = Off, 1 = Window Scaling, 2 = Timestamps, 3 = Both
$TCPRetries = 2 # TCP Retransmission Tries 2 = Min, X = Value of TcpMaxDupAcks, TcpMaxConnectRetransmissions, TcpMaxDataRetransmissions, MaxSynRetransmissions
$InitialRTO = 300 # Initial Retransmission Timeout 300 = Min, 65535 = Max (In milliseconds)
# With SQM, CAKE controls queueing, so CUBIC is preferred for latency consistency, while BBR2 may introduce bandwidth probing variation and cause spikes
# Without SQM, if the congestion control provider is set to CTCP or CUBIC, then the Pacing Profile should be set to "Always" for optimal performance
# - SQM 0 + BBR2 = Pacing Profile Initial Window
# - SQM 0 + CTCP = Pacing Profile Always
# - SQM 0 + CUBIC = Pacing Profile Always
# - SQM 1 + BBR2 = Pacing Profile Off
# - SQM 1 + CTCP = Pacing Profile Off
# - SQM 1 + CUBIC = Pacing Profile Off
if ($SQMRouter -eq 1) {
$CCProvider = 3
$PacProfile = 0
} elseif ($CCProvider -gt 1) {
$PacProfile = 4
}
# Congestion Control Provider
$CCP = @{
1 = "bbr2"
2 = "ctcp"
3 = "cubic"
}
# TCP Pacing Profile Level
$PPL = @{
0 = "off"
1 = "default"
2 = "initialwindow"
3 = "slowstart"
4 = "always"
}
# TCP Auto-Tuning Level
$ATL = @{
0 = "disabled"
1 = "normal"
2 = "restricted"
3 = "highlyrestricted"
4 = "experimental"
}
# DNS Providers
$DNS = @{
1 = @{ # Cloudflare
"ipv4-1" = "1.1.1.1"
"ipv4-2" = "1.0.0.1"
"ipv6-1" = "2606:4700:4700::1111"
"ipv6-2" = "2606:4700:4700::1001"
}
2 = @{ # Google
"ipv4-1" = "8.8.8.8"
"ipv4-2" = "8.8.4.4"
"ipv6-1" = "2001:4860:4860::8888"
"ipv6-2" = "2001:4860:4860::8844"
}
3 = @{ # OpenDNS
"ipv4-1" = "208.67.222.222"
"ipv4-2" = "208.67.220.220"
"ipv6-1" = "2620:119:35::35"
"ipv6-2" = "2620:119:53::53"
}
4 = @{ # NextDNS
"ipv4-1" = "45.90.28.0"
"ipv4-2" = "45.90.30.0"
"ipv6-1" = "2a07:a8c0::"
"ipv6-2" = "2a07:a8c1::"
}
5 = @{ # Quad9
"ipv4-1" = "9.9.9.9"
"ipv4-2" = "149.112.112.112"
"ipv6-1" = "2620:fe::fe"
"ipv6-2" = "2620:fe::9"
}
6 = @{ # AdGuard
"ipv4-1" = "94.140.14.14"
"ipv4-2" = "94.140.15.15"
"ipv6-1" = "2a10:50c0::ad1:ff"
"ipv6-2" = "2a10:50c0::ad2:ff"
}
7 = @{ # ControlD
"ipv4-1" = "76.76.2.0"
"ipv4-2" = "76.76.10.0"
"ipv6-1" = "2606:1a40::"
"ipv6-2" = "2606:1a40:1::"
}
8 = @{ # Gcore
"ipv4-1" = "95.85.95.85"
"ipv4-2" = "2.56.220.2"
"ipv6-1" = "2a03:90c0::1"
"ipv6-2" = "2a03:90c0::2"
}
}[$DNSProvider]
# NIC Advanced Properties
# Get-NetAdapterAdvancedProperty -AllProperties |
# Where-Object { $_.DisplayName -ne $null -and $_.DisplayValue -ne $null } |
# Sort-Object -Property RegistryKeyword |
# Select-Object -Property Name, RegistryKeyword, DisplayValue, DisplayName
$NIC = @{
1 = [ordered]@{ # Realtek
"*EEE" = 0
"*FlowControl" = 0
"*InterruptModeration" = 0
"*IPChecksumOffloadIPv4" = $Offloads
"*JumboPacket" = 1514
"*LsoV2IPv4" = 0
"*LsoV2IPv6" = 0
"*ModernStandbyWoLMagicPacket" = 0
"*NumRssQueues" = [Math]::Max(1, $RSSQueues)
"*PMARPOffload" = 0
"*PMNSOffload" = 0
"*PriorityVLANTag" = 0
"*ReceiveBuffers" = $RBuffers
"*RSS" = [Math]::Min(1, $RSSQueues)
"*SelectiveSuspend" = 0
"*SpeedDuplex" = 0
"*SSIdleTimeout" = 50
"*TCPChecksumOffloadIPv4" = $Offloads
"*TCPChecksumOffloadIPv6" = $Offloads
"*TransmitBuffers" = $TBuffers
"*UDPChecksumOffloadIPv4" = $Offloads
"*UDPChecksumOffloadIPv6" = $Offloads
"*WakeOnMagicPacket" = 0
"*WakeOnPattern" = 0
"AdvancedEEE" = 0
"EEEMaxSupportSpeed" = 5000
"EnableGreenEthernet" = 0
"GigaLite" = 0
"PowerSavingMode" = 0
"RegVlanid" = 0
"S5WakeOnLan" = 0
"WolShutdownLinkSpeed" = 2
}
2 = [ordered]@{ # Intel
"*EEE" = 0
"*FlowControl" = 0
"*InterruptModeration" = 0
"*IPChecksumOffloadIPv4" = $Offloads
"*JumboPacket" = 1514
"*LsoV2IPv4" = 0
"*LsoV2IPv6" = 0
"*PMARPOffload" = 0
"*PMNSOffload" = 0
"*PriorityVLANTag" = 0
"*ReceiveBuffers" = $RBuffers
"*SpeedDuplex" = 0
"*TCPChecksumOffloadIPv4" = $Offloads
"*TCPChecksumOffloadIPv6" = $Offloads
"*TransmitBuffers" = $TBuffers
"*UDPChecksumOffloadIPv4" = $Offloads
"*UDPChecksumOffloadIPv6" = $Offloads
"*WakeOnMagicPacket" = 0
"*WakeOnPattern" = 0
"AdvancedEEE" = 0
"EnableGreenEthernet" = 0
"GigaLite" = 0
"PowerSavingMode" = 0
"RegVlanid" = 0
"S5WakeOnLan" = 0
"WolShutdownLinkSpeed" = 2
}
}[$NICBrand]
# Disk Cleanup and Optimization
$SagerunProfile = 5555
Get-ChildItem "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches" | ForEach-Object {
Set-ItemProperty -Path $_.PsPath -Name "StateFlags$SagerunProfile" -Type "DWord" -Value 2 -Force
}
@{
"defrag" = "/AllVolumes /Optimize /Retrim /PrintProgress /Verbose"
"dism" = "/Online /Cleanup-Image /StartComponentCleanup /ResetBase"
"cleanmgr" = "/sagerun:$SagerunProfile"
}.GetEnumerator() | ForEach-Object {
Get-Process $_.Key -ErrorAction SilentlyContinue | Stop-Process -Force
Start-Process -FilePath ($_.Key + ".exe") -ArgumentList $_.Value
}
# Temporary files
@(
"$env:LocalAppData\Microsoft\Windows\WER\ReportArchive"
"$env:LocalAppData\Microsoft\Windows\WER\ReportQueue"
"$env:LocalAppData\Temp"
"$env:ProgramData\Microsoft\Windows\DeliveryOptimization\Cache"
"$env:ProgramData\Microsoft\Windows\WSUS\UpdateServicesPackages"
"$env:SystemDrive\MSOCache"
"$env:SystemDrive\Windows.old"
"$env:SystemRoot\Logs"
"$env:SystemRoot\Minidump"
"$env:SystemRoot\Prefetch"
"$env:SystemRoot\SoftwareDistribution\Download"
"$env:SystemRoot\Temp"
"$env:UserProfile\AppData\Local\CrashDumps"
"$env:UserProfile\AppData\Local\Microsoft\Windows\Explorer"
"$env:UserProfile\AppData\Local\Microsoft\Windows\History"
"$env:UserProfile\AppData\Local\Microsoft\Windows\INetCache"
"$env:UserProfile\AppData\Local\Microsoft\Windows\INetCookies"
"$env:UserProfile\AppData\Local\Packages\Microsoft.Windows.Caches"
"$env:UserProfile\AppData\Local\Temp"
"$env:UserProfile\AppData\LocalLow\Temp"
) + (
Get-ChildItem -Path "$env:UserProfile\AppData\Local\Packages" -Directory | Where-Object { $_.Name -like "Microsoft.Windows.ContentDeliveryManager_*" } | ForEach-Object { Join-Path $_.FullName "LocalState\Assets" }
) | ForEach-Object {
if (Test-Path $_) { Remove-Item -Path "$_\*" -Recurse -Force -ErrorAction SilentlyContinue }
}
Write-Custom "Successfully cleared temporary files"
# DirectX shader cache
@("$env:UserProfile\AppData", "$env:SystemRoot\System32\config\systemprofile\AppData") | ForEach-Object {
$X = $_
@("Local", "LocalLow", "Roaming") | ForEach-Object {
$Y = $_
@("AMD", "NVIDIA") | ForEach-Object {
$Path = "$X\$Y\$_"
if (Test-Path $Path) { Remove-Item -Path $Path -Recurse -Force -ErrorAction SilentlyContinue }
}
if ($Y -eq "Local") {
$Path = "$X\$Y\D3DSCache"
if (Test-Path $Path) { Remove-Item -Path $Path -Recurse -Force -ErrorAction SilentlyContinue }
}
}
}
if (Test-Path "HKCU:\Software\Valve\Steam") { Remove-Item "$((Get-ItemProperty -Path 'HKCU:\Software\Valve\Steam').SteamPath)\steamapps\shadercache" -Recurse -Force -ErrorAction SilentlyContinue }
Write-Custom "Successfully cleared DirectX shader cache"
# Windows Defender settings
@{
"PerformanceModeStatus" = "Disabled" # Virus & threat protection > Virus & threat protection settings > Dev Drive protection
"MAPSReporting" = "Disabled" # Virus & threat protection > Virus & threat protection settings > Cloud-delivered protection
"SubmitSamplesConsent" = "NeverSend" # Virus & threat protection > Virus & threat protection settings > Automatic sample submission
"EnableControlledFolderAccess" = "Disabled" # Virus & threat protection > Ransomware protection > Controlled folder access
# > Registry (Security) # App & browser control > Smart App Control
# > Registry (Security) # App & browser control > Reputation-based protection > Check apps and files
# > Registry (Security) # App & browser control > Reputation-based protection > SmartScreen for Microsoft Edge
# TODO: Find the correspondent setting # App & browser control > Reputation-based protection > Phishing protection
"PUAProtection" = "Disabled" # App & browser control > Reputation-based protection > Potentially unwanted app blocking
# > Registry (Security) # App & browser control > Reputation-based protection > SmartScreen for Microsoft Store Apps
}.GetEnumerator() | ForEach-Object {
Invoke-Custom "Set-MpPreference -$($_.Key) $($_.Value)"
}
# Windows Defender Scan folders to exclude
$ExcludedFolders | Where-Object { $_ } | ForEach-Object {
Invoke-Custom "Add-MpPreference -ExclusionPath $_"
}
# Windows Defender Scan and Exploit Protection processes to exclude
$ExcludedProcesses | Where-Object { $_ } | ForEach-Object {
Invoke-Custom "Add-MpPreference -ExclusionProcess $_"
Invoke-Custom "Set-ProcessMitigation -Name $_ -Disable $($ExploitProtections -join ",")"
}
# Services to stop and disable
$DisabledServices | Where-Object { $_ } | ForEach-Object {
Invoke-Custom "Stop-Service $_ -Force"
Invoke-Custom "Set-Service $_ -StartupType Disabled"
}
# Packages and apps to uninstall
$UninstalledPackages | Where-Object { $_ } | ForEach-Object {
Invoke-Custom "Get-AppxProvisionedPackage -Online | Where-Object { `$_.DisplayName -like '*$_*' } | ForEach-Object { Remove-AppxProvisionedPackage -Online -AllUsers -PackageName `$_.PackageName }"
Invoke-Custom "Get-AppxPackage -AllUsers | Where-Object { `$_.Name -like '*$_*' } | ForEach-Object { Remove-AppxPackage -AllUsers -Package `$_.PackageFullName }"
}
# Optional features to disable
$OptionalFeatures | Where-Object { $_ } | ForEach-Object {
Get-WindowsOptionalFeature -Online -FeatureName $_ | Where-Object { $_.State -eq "Enabled" } | Select-Object -ExpandProperty FeatureName | ForEach-Object {
Invoke-Custom "Disable-WindowsOptionalFeature -Online -NoRestart -FeatureName $_"
}
}
# WinGet and PowerShell
@(
"winget source update"
"winget upgrade --all --accept-package-agreements --accept-source-agreements"
"setx POWERSHELL_TELEMETRY_OPTOUT 1"
) | ForEach-Object {
Invoke-Custom $_
}
# Timers and Data Execution Prevention
@(
"bcdedit /set useplatformclock no"
"bcdedit /set useplatformtick no"
"bcdedit /set disabledynamictick yes"
"bcdedit /set ``{current``} nx OptIn"
"Get-PnpDevice -FriendlyName 'High Precision Event Timer' | Disable-PnpDevice -Confirm:`$False"
"Get-PnpDevice -FriendlyName 'Remote Desktop Device Redirector Bus' | Disable-PnpDevice -Confirm:`$False"
) | ForEach-Object {
Invoke-Custom $_
}
# Pagefile
@(
"Set-CimInstance -CimInstance (Get-CimInstance -ClassName Win32_ComputerSystem) -Arguments @{ AutomaticManagedPagefile = `$False }"
"Set-CimInstance -CimInstance (Get-CimInstance -ClassName Win32_PageFileSetting) -Arguments @{ InitialSize=$($Pagefile); MaximumSize=$($Pagefile) }"
) | ForEach-Object {
Invoke-Custom $_
}
# Windows Memory Management Agent
@(
"Disable-MMAgent -ApplicationLaunchPrefetching"
"Disable-MMAgent -ApplicationPreLaunch"
"Disable-MMAgent -MemoryCompression"
"Disable-MMAgent -OperationAPI"
"Disable-MMAgent -PageCombining"
"Set-MMAgent -MaxOperationAPIFiles 1"
) | ForEach-Object {
Invoke-Custom $_
}
# Global network settings
@(
"Set-NetOffloadGlobalSetting -Chimney Disabled"
"Set-NetOffloadGlobalSetting -NetworkDirect Enabled"
"Set-NetOffloadGlobalSetting -NetworkDirectAcrossIPSubnets Blocked"
"Set-NetOffloadGlobalSetting -PacketCoalescingFilter Disabled"
"Set-NetOffloadGlobalSetting -ReceiveSegmentCoalescing Disabled"
"Set-NetOffloadGlobalSetting -ReceiveSideScaling $($RSSQueues -gt 0 ? 'Enabled' : 'Disabled')"
"Set-NetOffloadGlobalSetting -TaskOffload $($Offloads -gt 0 ? 'Enabled' : 'Disabled')"
) | ForEach-Object {
Invoke-Custom $_
}
# Adapter network settings
$AdapterProperties = @(
"Disable-NetAdapterEncapsulatedPacketTaskOffload"
"Disable-NetAdapterIPsecOffload"
"Disable-NetAdapterLso"
"Disable-NetAdapterPowerManagement"
"Disable-NetAdapterQos"
"Disable-NetAdapterRsc"
"Disable-NetAdapterSriov"
"Disable-NetAdapterUso"
"Disable-NetAdapterVmq"
"$($Offloads -gt 0 ? 'Enable' : 'Disable')-NetAdapterChecksumOffload"
"$($RSSQueues -gt 0 ? 'Enable' : 'Disable')-NetAdapterRss"
Get-RSSCommand -RSSQueues $RSSQueues -RSSCore $RSSCore -NumCores $NumCores
)
# Network settings reset
@(
"ipconfig /release"
"ipconfig /release6"
"netsh winsock reset"
"netsh int ip reset"
"netsh int ipv4 reset"
"netsh int ipv6 reset"
"netsh int tcp reset"
"netsh int udp reset"
"netsh winhttp reset proxy"
"netsh int ip set dynamicport tcp start=49152 num=16384"
"netsh int ip set dynamicport udp start=49152 num=16384"
"netsh int tcp set supplemental template=none"
"netsh int teredo set state default"
"netsh int ipv4 delete arpcache"
"netsh int ipv4 delete destinationcache"
"netsh int ipv4 delete neighbors"
"netsh int ipv6 delete destinationcache"
"netsh int ipv6 delete neighbors"
"ipconfig /flushdns"
"ipconfig /renew"
"ipconfig /renew6"
"ipconfig /registerdns"
"nbtstat -R"
"nbtstat -RR"
) | ForEach-Object {
Invoke-Custom $_
}; Write-Host ""
# Network settings optimization
@(
"netsh int ip set dynamicport tcp start=32769 num=32766"
"netsh int ip set dynamicport udp start=32769 num=32766"
"netsh int ip set global addressmaskreply=disabled"
"netsh int ip set global defaultcurhoplimit=64"
"netsh int ip set global dhcpmediasense=enabled"
"netsh int ip set global flowlabel=disabled"
"netsh int ip set global groupforwardedfragments=disabled"
"netsh int ip set global icmpredirects=disabled"
"netsh int ip set global loopbackexecutionmode=inline"
"netsh int ip set global loopbacklargemtu=$($CCProvider -gt 1 ? 'enabled' : 'disabled')"
"netsh int ip set global loopbackworkercount=$($NumCores - 2)"
"netsh int ip set global mediasenseeventlog=disabled"
"netsh int ip set global minmtu=576"
"netsh int ip set global mldlevel=all"
"netsh int ip set global mldversion=version3"
"netsh int ip set global multicastforwarding=disabled"
"netsh int ip set global multiplearpannounce=enabled"
"netsh int ip set global neighborcachelimit=1024"
"netsh int ip set global randomizeidentifiers=disabled"
"netsh int ip set global reassemblylimit=267748640"
"netsh int ip set global reassemblyoutoforderlimit=32"
"netsh int ip set global routecachelimit=65536"
"netsh int ip set global routepolicies=disabled"
"netsh int ip set global slaacmaxdadattempts=1"
"netsh int ip set global sourcebasedecmp=enabled"
"netsh int ip set global sourceroutingbehavior=drop"
"netsh int ip set global taskoffload=$($Offloads -gt 0 ? 'enabled' : 'disabled')"
"netsh int ipv6 set global icmpjumbograms=disabled"
"netsh int ipv6 set global recursivereassembly=disabled"
"netsh int ipv6 set global slaacprivacylevel=0"
"netsh int tcp set global autotuninglevel=$($ATL[$AutoTuning])"
"netsh int tcp set global dca=enabled"
"netsh int tcp set global ecncapability=$($SQMRouter -gt 0 ? 'enabled' : 'disabled')"
"netsh int tcp set global fastopen=enabled"
"netsh int tcp set global fastopenfallback=enabled"
"netsh int tcp set global hystart=disabled"
"netsh int tcp set global initialrto=$($InitialRTO)"
"netsh int tcp set global maxsynretransmissions=$($TCPRetries)"
"netsh int tcp set global nonsackrttresiliency=disabled"
"netsh int tcp set global pacingprofile=$($PPL[$PacProfile])"
"netsh int tcp set global prr=enabled"
"netsh int tcp set global rsc=disabled"
"netsh int tcp set global rss=$($RSSQueues -gt 0 ? 'enabled' : 'disabled')"
"netsh int tcp set global timestamps=$($TCPOptions -in 2, 3 ? 'allowed' : 'disabled')"
"netsh int tcp set heuristics forcews=disabled"
"netsh int tcp set heuristics wsh=disabled"
"netsh int tcp set security mpp=disabled"
"netsh int tcp set security profiles=disabled"
"netsh int tcp set supplemental {template} congestionprovider=$($CCP[$CCProvider])"
"netsh int tcp set supplemental {template} delayedackfrequency=1"
"netsh int tcp set supplemental {template} delayedacktimeout=10"
"netsh int tcp set supplemental {template} enablecwndrestart=disabled"
"netsh int tcp set supplemental {template} icw=10"
"netsh int tcp set supplemental {template} minrto=200"
"netsh int tcp set supplemental {template} rack=enabled"
"netsh int tcp set supplemental {template} taillossprobe=enabled"
"netsh int teredo set state disabled"
"netsh int udp set global uro=disabled"
"netsh int udp set global uso=disabled"
"netsh winsock set autotuning $($AutoTuning -gt 0 ? 'on' : 'off')"
) | ForEach-Object {
$X = $_
if ($X -match "^netsh int ip") {
$Y = "$X store=persistent"
Invoke-Custom ($Y -match 'slaacprivacylevel' ? $Y : ($Y -replace 'ipv6','ip'))
}
if ($x -match "^netsh int tcp set supplemental") {
@("compat", "custom", "datacenter", "datacentercustom", "internet", "internetcustom") | ForEach-Object {
$Y = $X -replace "{template}", $_
Invoke-Custom $Y
$NetshCommands += "$Y`n"
}
} else {
Invoke-Custom $X
if ($X -notmatch "^netsh int tcp set global timestamps=") { # Prevent overriding Tcp1323Opts in Registry
$NetshCommands += "$X`n"
}
}
}
# Adapter settings optimization
Get-NetAdapter -Physical | Where-Object { $_.InterfaceType -eq 6 } | ForEach-Object {
$Adapter = $_
@("ipv4", "ipv6") | ForEach-Object {
$W = "netsh int $_ set subinterface $($Adapter.ifIndex) mtu=1500"; Invoke-Custom "$W store=persistent"; Invoke-Custom $W; $NetshCommands += "$W`n"
if ($DNSProvider -eq 0) {
$X = "netsh int $_ set dns $($Adapter.ifIndex) dhcp"; Invoke-Custom $X; $NetshCommands += "$X`n"
} else {
$Y = "netsh int $_ set dns $($Adapter.ifIndex) static $($DNS["$_-1"]) primary"; Invoke-Custom $Y; $NetshCommands += "$Y`n"
$Z = "netsh int $_ add dns $($Adapter.ifIndex) $($DNS["$_-2"]) index=2"; Invoke-Custom $Z; $NetshCommands += "$Z`n"
}