-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGamingTweaks.ps1
More file actions
162 lines (136 loc) · 6.88 KB
/
GamingTweaks.ps1
File metadata and controls
162 lines (136 loc) · 6.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# EsportsTweakPack_Final.ps1
# Author: Christopher Alphonse
# Purpose: Apply competitive-level system tweaks
# ===============================
# 1. Registry Backup
# ===============================
$backupPath = "C:\RegistryBackup\GamingTweaksBackup.reg"
if (-not (Test-Path "C:\RegistryBackup")) {
New-Item -Path "C:\" -Name "RegistryBackup" -ItemType Directory | Out-Null
}
reg export "HKLM\SYSTEM\CurrentControlSet" $backupPath /y
Write-Output "Registry backup created at $backupPath"
# ===============================
# 2. Ultimate Performance Plan
# ===============================
powercfg -duplicatescheme e9a42b02-d5df-448d-aa00-03f14749eb61 | Out-Null
powercfg -setactive e9a42b02-d5df-448d-aa00-03f14749eb61
Write-Output "Ultimate Performance Power Plan enabled."
# ===============================
# 3. Disable Fullscreen Optimizations + Game Bar
# ===============================
Set-ItemProperty -Path "HKCU:\System\GameConfigStore" -Name "GameDVR_FSEBehaviorMode" -Value 2
Set-ItemProperty -Path "HKCU:\System\GameConfigStore" -Name "GameDVR_HonorUserFSEBehaviorMode" -Value 2
Set-ItemProperty -Path "HKCU:\System\GameConfigStore" -Name "GameDVR_Enabled" -Value 0
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\GameDVR" -Name "AppCaptureEnabled" -Value 0
Write-Output "Fullscreen optimizations and Game DVR disabled."
# Remove Xbox Game Bar
Get-AppxPackage *Microsoft.XboxGamingOverlay* | Remove-AppxPackage -ErrorAction SilentlyContinue
Write-Output "Xbox Game Bar removed."
# ===============================
# 4. Optimize Memory Management
# ===============================
$memPath = "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management"
Set-ItemProperty -Path $memPath -Name "DisablePagingExecutive" -Value 1
Set-ItemProperty -Path $memPath -Name "LargeSystemCache" -Value 1
Write-Output " Memory management optimized."
# ===============================
# 5. Disable Nagle’s Algorithm (Low Latency Network)
# ===============================
$ip = (Get-NetIPAddress -AddressFamily IPv4 | Where-Object { $_.InterfaceAlias -notlike "*Loopback*" }).IPAddress
$interfacePath = "HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces"
Get-ChildItem $interfacePath | ForEach-Object {
$child = $_.PSChildName
$props = Get-ItemProperty -Path "$interfacePath\$child" -ErrorAction SilentlyContinue
if ($props.DhcpIPAddress -eq $ip) {
Set-ItemProperty -Path "$interfacePath\$child" -Name "TcpAckFrequency" -Value 1 -Force
Set-ItemProperty -Path "$interfacePath\$child" -Name "TCPNoDelay" -Value 1 -Force
}
}
Write-Output " Nagle’s Algorithm disabled."
# ===============================
# 6. Disable Startup Programs
# ===============================
Get-CimInstance Win32_StartupCommand | Where-Object {
$_.Name -notlike "*Microsoft*" -and $_.Command -notlike "*Windows Defender*"
} | ForEach-Object {
Write-Output "Disabling startup: $($_.Name)"
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Run" -Name $_.Name -ErrorAction SilentlyContinue
}
Write-Output " Non-essential startup programs disabled."
# ===============================
# 7. Optimize Visual Effects
# ===============================
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects" -Name "VisualFXSetting" -Value 2
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "UserPreferencesMask" -Value ([byte[]](0x90,0x12,0x03,0x80,0x10,0x00,0x00,0x00))
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "DragFullWindows" -Value 0
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "MenuShowDelay" -Value 0
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "AutoEndTasks" -Value 1
Write-Output " Visual effects optimized."
# ===============================
# 8. Disable Non-Essential Services
# ===============================
$services = @("SysMain", "WSearch", "DiagTrack", "RetailDemo", "XblGameSave", "XboxNetApiSvc")
foreach ($service in $services) {
if (Get-Service -Name $service -ErrorAction SilentlyContinue) {
Stop-Service -Name $service -Force -ErrorAction SilentlyContinue
Set-Service -Name $service -StartupType Disabled
Write-Output "Disabled service: $service"
}
}
Write-Output " Non-essential services disabled."
# ===============================
# 9. Disable NDU (DPC Latency Fix)
# ===============================
Stop-Service -Name Ndu -Force -ErrorAction SilentlyContinue
Set-Service -Name Ndu -StartupType Disabled
Write-Output " NDU disabled to reduce DPC latency."
# ===============================
# 10. Enable Hardware-Accelerated GPU Scheduling
# ===============================
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\GraphicsDrivers" -Name "HwSchMode" -Value 2
Write-Output " Hardware-accelerated GPU scheduling enabled."
# ===============================
# 11. (Optional) Disable HPET via BCD
# ===============================
bcdedit /deletevalue useplatformclock > $null 2>&1
Write-Output " HPET disabled (via BCDedit)."
# ===============================
# 12. Input Queue Sizes
# ===============================
$isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
if (-not $isAdmin) {
Write-Error "This script requires administrative privileges. Please run PowerShell as Administrator."
exit
}
$mouseRegPath = "HKLM:\SYSTEM\CurrentControlSet\Services\mouhid\Parameters"
$mouseRegKey = "MouseDataQueueSize"
$mouseValue = 12
$keyboardRegPath = "HKLM:\SYSTEM\CurrentControlSet\Services\kbdhid\Parameters"
$keyboardRegKey = "KeyboardDataQueueSize"
$keyboardValue = 12
try {
if (-not (Test-Path $mouseRegPath)) {
Write-Output "Registry path $mouseRegPath does not exist. Creating it..."
New-Item -Path $mouseRegPath -Force | Out-Null
}
Set-ItemProperty -Path $mouseRegPath -Name $mouseRegKey -Value $mouseValue -Type DWord -Force
Write-Output "Successfully set $mouseRegKey to $mouseValue."
if (-not (Test-Path $keyboardRegPath)) {
Write-Output "Registry path $keyboardRegPath does not exist. Creating it..."
New-Item -Path $keyboardRegPath -Force | Out-Null
}
Set-ItemProperty -Path $keyboardRegPath -Name $keyboardRegKey -Value $keyboardValue -Type DWord -Force
Write-Output "Successfully set $keyboardRegKey to $keyboardValue."
Write-Output "Please restart your computer for the changes to take effect."
}
catch {
Write-Error "Failed to set input queue sizes. Error: $_"
}
# ===============================
# 13. Prompt for Restart
# ===============================
$restart = Read-Host "`nChanges applied successfully. Restart now? (Y/N)"
if ($restart -match "^[Yy]$") {
Restart-Computer
}