if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { Write-Host "You need to run this script as an administrator!" -ForegroundColor Red exit }
Write-Host "Starting the ultimate Windows performance optimization script..." -ForegroundColor Yellow
Write-Host "Optimizing CPU core parking and throttling settings..." -ForegroundColor Yellow
$guid = "0cc5b647-c1df-4637-891a-dec35c318583" powercfg /setacvalueindex scheme_current sub_processor $guid 0 powercfg /setdcvalueindex scheme_current sub_processor $guid 0 powercfg -setactive scheme_current
$procThrottleMin = "893dee8e-2bef-41e0-89c6-b55d0929964c" $procThrottleMax = "bc5038f7-23e0-4960-96da-33abaf5935ec" powercfg /setacvalueindex scheme_current sub_processor $procThrottleMin 100 powercfg /setacvalueindex scheme_current sub_processor $procThrottleMax 100 powercfg -setactive scheme_current
Write-Host "Optimizing memory management and virtual memory..." -ForegroundColor Yellow $memoryPath = "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management"
New-ItemProperty -Path $memoryPath -Name "DisablePagingExecutive" -Value 1 -Force
New-ItemProperty -Path $memoryPath -Name "LargeSystemCache" -Value 1 -Force New-ItemProperty -Path $memoryPath -Name "IoPageLockLimit" -Value 524288 -Force # 512MB I/O cache
New-ItemProperty -Path $memoryPath -Name "PagingFiles" -Value "C:\pagefile.sys 2048 4096" -Force
Write-Host "Optimizing disk I/O performance and NTFS..." -ForegroundColor Yellow
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "NtfsDisableLastAccessUpdate" -Value 1 -Force
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "NtfsDisable8dot3NameCreation" -Value 1 -Force
Write-Host "Disabling power-saving features for maximum performance..." -ForegroundColor Yellow
powercfg -duplicatescheme e9a42b02-d5df-448d-aa00-03f14749eb61
powercfg /change disk-timeout-ac 0
powercfg -h off
$usbSuspendGuid = "2a737441-1930-4402-8d77-b2bebba308a3" powercfg /setacvalueindex scheme_current sub_usb $usbSuspendGuid 0 powercfg /setdcvalueindex scheme_current sub_usb $usbSuspendGuid 0 powercfg -setactive scheme_current
Write-Host "Stopping and disabling DoSvc (Delivery Optimization) service..." -ForegroundColor Yellow
sc stop DoSvc sc config DoSvc start= disabled