-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWindows11GPUConfig.ps1
More file actions
125 lines (104 loc) · 4.8 KB
/
Windows11GPUConfig.ps1
File metadata and controls
125 lines (104 loc) · 4.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
# ============================
# 🏆 ULTIMATE WINDOWS 11 CLEANUP & OPTIMIZATION SCRIPT
# ============================
# 🚀 Optimizes Performance, Cleans Junk, Removes Bloat, Clears Registry, Sets GPU Preferences, Adjusts Virtual Memory
# ⚠️ RUN AS ADMINISTRATOR!
# Ensure script runs with admin privileges
function Check-Admin {
$currentUser = [Security.Principal.WindowsIdentity]::GetCurrent()
$principal = New-Object Security.Principal.WindowsPrincipal($currentUser)
if (-not $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Host "❌ Please run this script as Administrator!" -ForegroundColor Red
exit
}
}
Check-Admin
# ============================
# 🚹 1. DEEP SYSTEM CLEANUP
# ============================
Write-Host "🥳 Running deep system cleanup..." -ForegroundColor Yellow
# Delete Temp files
Remove-Item -Path "$env:TEMP\*" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path "C:\Windows\Temp\*" -Recurse -Force -ErrorAction SilentlyContinue
# Delete Windows.old if it exists
$windowsOld = "C:\Windows.old"
if (Test-Path $windowsOld) {
Remove-Item -Path $windowsOld -Recurse -Force
}
# Clear Windows Update Cache
Stop-Service wuauserv -Force
Remove-Item -Path "C:\Windows\SoftwareDistribution\Download\*" -Recurse -Force
Start-Service wuauserv
# Empty Recycle Bin
Clear-RecycleBin -Force -ErrorAction SilentlyContinue
Write-Host "✅ System Cleanup Complete!" -ForegroundColor Green
# ============================
# 🚀 2. WINDOWS PERFORMANCE BOOST
# ============================
Write-Host "⚡ Applying Windows Performance Tweaks..." -ForegroundColor Yellow
# Disable Hibernate to Save Space
powercfg -h off
# Disable Startup Delay for Faster Boot
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Serialize" /v StartupDelayInMSec /t REG_DWORD /d 0 /f
# Enable High-Performance Power Plan
powercfg -setactive SCHEME_MIN
Write-Host "✅ Performance Boost Applied!" -ForegroundColor Green
# ============================
# 🚽 3. UNINSTALL BLOATWARE & UNUSED PROGRAMS
# ============================
Write-Host "🚹 Removing Bloatware & Unused Apps..." -ForegroundColor Yellow
$appsToRemove = @(
"Microsoft.3DBuilder", "Microsoft.BingNews", "Microsoft.GetHelp", "Microsoft.MicrosoftSolitaireCollection",
"Microsoft.NetworkSpeedTest", "Microsoft.OneConnect", "Microsoft.People", "Microsoft.Print3D",
"Microsoft.SkypeApp", "Microsoft.Xbox.TCUI", "Microsoft.XboxApp", "Microsoft.XboxGameOverlay"
)
foreach ($app in $appsToRemove) {
Get-AppxPackage -Name $app | Remove-AppxPackage -ErrorAction SilentlyContinue
}
Write-Host "✅ Bloatware Removed!" -ForegroundColor Green
# ============================
# 🧜 4. REGISTRY CLEANUP
# ============================
Write-Host "🧹 Cleaning Registry..." -ForegroundColor Yellow
# Remove Old Software Registry Keys
$keysToRemove = @("HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*", "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*")
foreach ($key in $keysToRemove) {
Remove-Item -Path $key -Recurse -Force -ErrorAction SilentlyContinue
}
Write-Host "✅ Registry Cleanup Complete!" -ForegroundColor Green
# ============================
# 🔧 5. SET GPU PREFERENCES
# ============================
function Set-GpuPreference {
param ([string]$AppPath, [string]$Preference)
$regPath = "HKCU:\Software\Microsoft\DirectX\UserGpuPreferences"
$value = "${AppPath},$Preference"
if (-not (Test-Path $regPath)) {
New-Item -Path "HKCU:\Software\Microsoft\DirectX" -Name "UserGpuPreferences" -Force
}
Set-ItemProperty -Path $regPath -Name $AppPath -Value $value
}
$gpuApps = @("C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe", "C:\Program Files\Google\Chrome\Application\chrome.exe",
"C:\Program Files\Mozilla Firefox\firefox.exe", "C:\Program Files\Microsoft Office\root\Office16\WINWORD.EXE")
foreach ($app in $gpuApps) {
Set-GpuPreference $app 2
}
Write-Host "✅ GPU Preferences Applied!" -ForegroundColor Green
# ============================
# 🛠️ 6. SET VIRTUAL MEMORY
# ============================
function Set-VirtualMemory {
param ([int]$InitialSizeMB, [int]$MaximumSizeMB)
$regPath = "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management"
$value = "C:\pagefile.sys $InitialSizeMB $MaximumSizeMB"
Set-ItemProperty -Path $regPath -Name "PagingFiles" -Value $value
}
Set-VirtualMemory -InitialSizeMB 16384 -MaximumSizeMB 32768
Write-Host "✅ Virtual Memory Adjusted! Restart required." -ForegroundColor Green
# ============================
# 🎥 FINISH & RESTART PROMPT
# ============================
Write-Host "
🎯 Optimization Completed! A restart is recommended."
Write-Host "Press any key to exit..." -ForegroundColor Cyan
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")