Untitled

 avatar
unknown
plain_text
9 months ago
8.0 kB
17
Indexable
<# SpeedBoost.ps1 — Safe Windows performance tune-up Actions (all
per-user unless noted): • Disable common startup apps (Discord, Steam,
Spotify, Teams, Zoom, Epic, OneDrive if present) • Move startup items to
a backup instead of deleting • Clean temp files (%TEMP%), Windows Temp
(admin only), and browser caches (Edge/Chrome safe temp paths only) •
Empty Recycle Bin • Enable Storage Sense defaults (per-user; Windows
10/11) • Set power plan to High performance if available (plugged in
systems) • Optimize drives (TRIM for SSD / defrag HDD) if running as
Admin • Turn off Xbox background services (set to Manual; Admin only) •
Produce a summary report

    How to run:
      1) Right‑click PowerShell → “Run as administrator” (recommended, but not required)
      2) In PowerShell:  Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
      3) Then:           .\SpeedBoost.ps1

    Notes:
      • Everything is reversible: startup entries are moved to a backup key/folder.
      • No registry values are deleted without a backup.

#>

[CmdletBinding()] param(
[switch]SkipDriveOptimize, [switch]SkipPowerPlan, [switch]$VerboseLog )

$ErrorActionPreference = “SilentlyContinue” $ProgressPreference =
‘SilentlyContinue’

function Write-Info($msg){ Write-Host “[*]
$msg" } function Write-Done($msg){ Write-Host”[OK]
$msg" -ForegroundColor Green } function Write-Warn($msg){ Write-Host
“[!] $msg" -ForegroundColor Yellow } function Write-Err($msg){
Write-Host”[x] $msg” -ForegroundColor Red }

Detect Admin

$IsAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator") if($IsAdmin){
Write-Info “Running as Administrator: extended actions enabled.” } else
{ Write-Warn “Not running as Administrator: some steps will be skipped
(system temp, drive optimize, service tweaks).” }

Global report

$Report = New-Object System.Collections.ArrayList

Helper: ensure a registry key exists

function Ensure-Key($path){ if(-not (Test-Path $path)){ New-Item -Path
$path -Force | Out-Null } }

1) Disable common startup apps (move to backup instead of delete)

Write-Info “Scanning startup entries…” $commonApps = @( @{
NamePattern=“Discord”; RunValue=“Discord” }, @{ NamePattern=“Steam”;
RunValue=“Steam” }, @{ NamePattern=“Spotify”; RunValue=“Spotify” }, @{
NamePattern=“Microsoft Teams”; RunValue=“com.squirrel.Teams.Teams” }, @{
NamePattern=“Zoom”; RunValue=“Zoom” }, @{ NamePattern=“Epic Games”;
RunValue=“EpicGamesLauncher” }, @{ NamePattern=“OneDrive”;
RunValue=“OneDrive” } )

$runHKCU = “HKCU:” $runBackupHKCU = “HKCU:” Ensure-Key $runBackupHKCU

disabled = @()foreach(app in $commonApps){ $val = (Get-ItemProperty
-Path $runHKCU -Name
app.RunValue − ErrorActionSilentlyContinue).(app.RunValue)if(null -ne
$val){ Set-ItemProperty -Path $runBackupHKCU -Name $app.RunValue -Value
$val -Force | Out-Null Remove-ItemProperty -Path $runHKCU -Name
$app.RunValue -Force | Out-Null $disabled += $app.RunValue } }

Startup folder shortcuts

$startupFolder = "$env:APPDATAMenu” $startupBackup = "$env:APPDATA”
if(-not (Test-Path $startupBackup)){ New-Item -Path $startupBackup
-ItemType Directory -Force | Out-Null }

$files = Get-ChildItem -Path $startupFolder -File -ErrorAction
SilentlyContinue filesToMove = @()foreach(f in $files){  foreach($app in
$commonApps){  if($f.Name -match $app.NamePattern){ $filesToMove +=
$f  break  }  } } foreach($f in $filesToMove){ Move-Item -Path
$f.FullName -Destination (Join-Path $startupBackup
$f.Name) -Force } if($disabled.Count -gt 0 -or $filesToMove.Count -gt
0){ $Report.Add(“Disabled startup items: (disabled -join ‘,’) | Moved
shortcuts: (filesToMove.Name -join ‘,’)”) | Out-Null Write-Done “Startup
cleanup complete.” } else { Write-Info “No common startup items found to
disable.” }

2) Clean temp files

function Clear-Dir($path){ if(Test-Path $path){ Get-ChildItem -Path
$path -Recurse -Force -ErrorAction SilentlyContinue | Remove-Item
-Recurse -Force -ErrorAction SilentlyContinue } } Write-Info “Cleaning
temp files…” $userTemp = $env:TEMP Clear-Dir $userTemp

if($IsAdmin){ Clear-Dir “C:” }

Edge/Chrome temp caches (safe temp dirs)

$edgeTemp = Join-Path $env:LOCALAPPDATA “MicrosoftData” $chromeTemp =
Join-Path $env:LOCALAPPDATA “GoogleData” Clear-Dir $edgeTemp Clear-Dir
$chromeTemp

$Report.Add(“Temp files cleaned (User temp, Edge/Chrome temp cache).”) |
Out-Null Write-Done “Temp cleanup complete.”

3) Empty Recycle Bin

Write-Info “Emptying Recycle Bin…” try{ (New-Object -ComObject
Shell.Application).NameSpace(0xA).Items() | ForEach-Object { Remove-Item
$_.Path -Recurse -Force -ErrorAction SilentlyContinue }
$Report.Add(“Recycle Bin emptied.”) | Out-Null Write-Done “Recycle Bin
emptied.” }catch{ Write-Warn “Could not empty Recycle Bin.” }

4) Enable Storage Sense defaults (per-user)

Write-Info “Configuring Storage Sense…” $ssBase = “HKCU:” Ensure-Key
$ssBase # Common defaults: 1=enabled New-ItemProperty -Path $ssBase
-Name “01” -PropertyType DWord -Value 1 -Force | Out-Null # Enable
New-ItemProperty -Path $ssBase -Name “2048” -PropertyType DWord -Value 1
-Force | Out-Null # Cleanup temp files New-ItemProperty -Path $ssBase
-Name “256” -PropertyType DWord -Value 1 -Force | Out-Null # Recycle Bin
cleanup New-ItemProperty -Path $ssBase -Name “512” -PropertyType DWord
-Value 30 -Force | Out-Null # Recycle Bin days New-ItemProperty -Path
$ssBase -Name “32” -PropertyType DWord -Value 1 -Force | Out-Null #
Downloads cleanup off by default (0), set 1 to enable if desired
$Report.Add(“Storage Sense enabled with safe defaults (Temp cleanup on;
Recycle Bin 30 days).”) | Out-Null Write-Done “Storage Sense
configured.”

5) Power plan: set High performance if available

if(-not $SkipPowerPlan){ Write-Info “Adjusting power plan (if
available)…” try{ $plans = powercfg /L hi = (plans | Select-String
-Pattern “High performance”).ToString() if($hi){ guid = (hi -split
‘+’)[3] powercfg /S $guid | Out-Null $Report.Add(“Power plan set to High
performance.”) | Out-Null Write-Done “Power plan set to High
performance.” } else { $Report.Add(“High performance plan not present.
No change.”) | Out-Null Write-Warn “High performance plan not present.”
} }catch{ Write-Warn “Could not adjust power plan.” } }

6) Optimize drives (Admin only unless skipped)

if($IsAdmin -and -not $SkipDriveOptimize){ Write-Info “Optimizing drives
(TRIM for SSD / defrag HDD) …” try{ $vols = Get-Volume | Where-Object {
_(.)DriveLetter − match′^([A−Z])’ -and $_.FileSystem -ne
$null }  foreach($v in $vols){ try{ Optimize-Volume -DriveLetter
v.DriveLetter − Verbose:false -ErrorAction SilentlyContinue | Out-Null
}catch{} } $Report.Add(“Optimize-Volume executed on all fixed drives.”)
| Out-Null Write-Done “Drive optimization done.” }catch{ Write-Warn
“Optimize-Volume not available.” } } elseif(-not $IsAdmin){ Write-Warn
“Skipping drive optimization (Admin required).” }

7) Disable Xbox background services (Admin)

if($IsAdmin){
$xboxSvcs = "XblAuthManager","XblGameSave","XboxNetApiSvc"  foreach($svc
in $xboxSvcs){ try{ Set-Service -Name $svc -StartupType Manual
-ErrorAction SilentlyContinue Stop-Service -Name $svc -ErrorAction
SilentlyContinue }catch{} } $Report.Add(“Xbox services set to Manual
(stopped).”) | Out-Null Write-Done “Xbox background services minimized.”
}

Summary

Write-Host “” Write-Host “========== SPEEDBOOST SUMMARY ==========”
-ForegroundColor Cyan $Report | ForEach-Object { Write-Host ” - $_” }
Write-Host “========================================” -ForegroundColor
Cyan

Write-Host “” Write-Host “Reboot recommended to feel all improvements.”
-ForegroundColor Yellow
Editor is loading...
Leave a Comment