Guest User

Enable Performance Script

a guest
Oct 23rd, 2025
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # ------------------------------------------------------------
  2. # WINDOWS 11 PERFORMANCE OPTIMIZATION FOR REMOTE STREAMING
  3. # MODE: MAXIMUM PERFORMANCE (Defender enabled)
  4. # ------------------------------------------------------------
  5. # Description:
  6. # This PowerShell script optimizes Windows 11 for remote streaming
  7. # by disabling unnecessary services, removing bloatware,
  8. # minimizing visual effects, and enabling the maximum performance plan.
  9. # Windows Defender remains active to ensure system protection.
  10. #
  11. # How to Run:
  12. # 1. Save this script as "Optimize-Windows11.ps1".
  13. # 2. Open PowerShell as Administrator and run: Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
  14. # 3. Right-click the file and select "Run with PowerShell".
  15. #    (Alternatively, open PowerShell as Administrator and run it manually.)
  16. # 4. If execution is blocked, enable script execution temporarily:
  17. #       Set-ExecutionPolicy Bypass -Scope Process -Force
  18. # 5. After execution, restart your PC to apply all optimizations.
  19. # ------------------------------------------------------------
  20.  
  21. Write-Host "Starting advanced Windows 11 optimization..." -ForegroundColor Cyan
  22.  
  23. # 1. Stop and disable unnecessary services
  24. $services = @(
  25.   "SysMain",
  26.   "DiagTrack",
  27.   "WSearch",
  28.   "WerSvc",
  29.   "RemoteRegistry",
  30.   "Fax",
  31.   "RetailDemo",
  32.   "MapsBroker",
  33.   "SharedAccess",
  34.   "BluetoothSupportService",
  35.   "OneSyncSvc",
  36.   "PhoneSvc",
  37.   "CDPUserSvc",
  38.   "edgeupdate",
  39.   "edgeupdatem"
  40. )
  41.  
  42. foreach ($service in $services) {
  43.     Get-Service -Name $service -ErrorAction SilentlyContinue | ForEach-Object {
  44.         Stop-Service -Name $_.Name -ErrorAction SilentlyContinue
  45.         Set-Service -Name $_.Name -StartupType Disabled
  46.         Write-Host "Service disabled: $($_.Name)"
  47.     }
  48. }
  49.  
  50. # 2. Disable telemetry and diagnostic scheduled tasks
  51. Write-Host "Disabling telemetry tasks..." -ForegroundColor Yellow
  52. $tasks = @(
  53.   "\Microsoft\Windows\Application Experience\ProgramDataUpdater",
  54.   "\Microsoft\Windows\Customer Experience Improvement Program\Consolidator",
  55.   "\Microsoft\Windows\Customer Experience Improvement Program\UsbCeip",
  56.   "\Microsoft\Windows\DiskDiagnostic\Microsoft-Windows-DiskDiagnosticDataCollector",
  57.   "\Microsoft\Windows\Feedback\Siuf\DmClient",
  58.   "\Microsoft\Windows\Feedback\Siuf\DmClientOnScenarioDownload"
  59. )
  60. foreach ($task in $tasks) {
  61.   schtasks /Change /TN $task /Disable 2>$null
  62. }
  63.  
  64. # 3. Disable and remove OneDrive integration
  65. Write-Host "Removing OneDrive..." -ForegroundColor Yellow
  66. taskkill /f /im OneDrive.exe 2>$null
  67. Start-Sleep -s 2
  68. & "$env:SystemRoot\System32\OneDriveSetup.exe" /uninstall
  69. Remove-Item "$env:UserProfile\OneDrive" -Recurse -Force -ErrorAction SilentlyContinue
  70. Remove-Item "C:\OneDriveTemp" -Recurse -Force -ErrorAction SilentlyContinue
  71. Write-Host "OneDrive removed."
  72.  
  73. # 4. Disable Cortana, Widgets, and News
  74. Write-Host "Disabling Cortana and Widgets..." -ForegroundColor Yellow
  75. reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v AllowCortana /t REG_DWORD /d 0 /f
  76. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Feeds" /v ShellFeedsTaskbarViewMode /t REG_DWORD /d 2 /f
  77. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Feeds" /v EnableFeeds /t REG_DWORD /d 0 /f
  78. Write-Host "Cortana and Widgets disabled."
  79.  
  80. # 5. Disable Edge AutoUpdate (keeps Edge installed)
  81. Write-Host "Disabling Edge auto updates..." -ForegroundColor Yellow
  82. reg add "HKLM\SOFTWARE\Policies\Microsoft\EdgeUpdate" /v AutoUpdateCheckPeriodMinutes /t REG_DWORD /d 0 /f
  83. reg add "HKLM\SOFTWARE\Policies\Microsoft\EdgeUpdate" /v UpdateDefault /t REG_DWORD /d 0 /f
  84.  
  85. # 6. Set power plan to maximum performance
  86. Write-Host "Setting power plan to maximum performance..." -ForegroundColor Yellow
  87. powercfg -duplicatescheme e9a42b02-d5df-448d-aa00-03f14749eb61 >$null
  88. powercfg -setactive e9a42b02-d5df-448d-aa00-03f14749eb61
  89. powercfg -change -monitor-timeout-ac 0
  90. powercfg -change -disk-timeout-ac 0
  91. powercfg -change -standby-timeout-ac 0
  92. powercfg -hibernate off
  93. Write-Host "Power plan set."
  94.  
  95. # 7. Minimize visual effects
  96. Write-Host "Disabling animations, transparency, and effects..." -ForegroundColor Yellow
  97. Set-ItemProperty "HKCU:\Control Panel\Desktop" "UserPreferencesMask" ([byte[]](0x90,0x12,0x03,0x80,0x10,0x00,0x00,0x00))
  98. Set-ItemProperty "HKCU:\Control Panel\Desktop\WindowMetrics" MinAnimate 0
  99. Set-ItemProperty "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects" VisualFXSetting 2
  100. Set-ItemProperty "HKCU:\Software\Microsoft\Windows\DWM" EnableAeroPeek 0
  101. Set-ItemProperty "HKCU:\Software\Microsoft\Windows\DWM" EnableBlurBehind 0
  102.  
  103. # 8. Remove unnecessary preinstalled apps
  104. Write-Host "Removing unnecessary apps..." -ForegroundColor Yellow
  105. $apps = @(
  106.   "*xbox*", "*bing*", "*news*", "*weather*", "*onenote*", "*skype*",
  107.   "*feedback*", "*maps*", "*solitaire*", "*people*", "*cortana*", "*getstarted*"
  108. )
  109. foreach ($app in $apps) {
  110.   Get-AppxPackage -Name $app -AllUsers | Remove-AppxPackage -ErrorAction SilentlyContinue
  111. }
  112.  
  113. # 9. Optimize network and disable Delivery Optimization
  114. Write-Host "Disabling Delivery Optimization and P2P services..." -ForegroundColor Yellow
  115. Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" -Name DODownloadMode -Value 0 -Force
  116. netsh int tcp set global autotuninglevel=disabled
  117. netsh int tcp set global rss=enabled
  118. netsh int tcp set global chimney=enabled
  119.  
  120. # 10. Keep Windows Defender active but reduce telemetry
  121. Write-Host "Keeping Windows Defender active (efficient mode)..." -ForegroundColor Yellow
  122. Set-MpPreference -MAPSReporting 0 -ErrorAction SilentlyContinue
  123. Set-MpPreference -SubmitSamplesConsent 2 -ErrorAction SilentlyContinue
  124. Set-MpPreference -PUAProtection Enabled -ErrorAction SilentlyContinue
  125.  
  126. # Final cleanup
  127. Write-Host "Final cleanup and summary..." -ForegroundColor Cyan
  128. Start-Sleep -s 2
  129. Write-Host "Services minimized"
  130. Write-Host "Visual effects disabled"
  131. Write-Host "Telemetry and bloatware removed"
  132. Write-Host "Windows Defender optimized and active"
  133. Write-Host "Restart your PC to apply all changes." -ForegroundColor Green
  134.  
Add Comment
Please, Sign In to add comment