Загрузка данных
#requires -Version 5.1
#requires -RunAsAdministrator
<#
=============================================================
WINDOWS 11 ULTIMATE DEBLOAT & OPTIMIZATION
=============================================================
Features:
- Restore point and registry backups
- Telemetry and advertising restrictions
- Removal of selected Appx applications
- OneDrive removal
- Optional Microsoft Edge browser removal
- Edge background activity restrictions
- Game DVR and Xbox overlay cleanup
- Explorer customization
- High Performance power plan
- Temporary files cleanup
PROTECTED:
- Windows Defender and Security Center
- Windows Update
- Print Spooler
- Bluetooth and Wi-Fi
- Network services
- DirectX, .NET, VC++ and drivers
- Microsoft Edge WebView2
=============================================================
#>
$ErrorActionPreference = "Continue"
# =============================================================
# CONFIGURATION
# =============================================================
$RemoveEdge = $true
$RemoveOneDrive = $true
$RemoveXboxApps = $true
$CleanTempFiles = $true
$CreateRestorePoint = $true
$LogFile = "$env:SystemDrive\Ultimate_Optimization.log"
$BackupDir = "$env:SystemDrive\Ultimate_Backup"
# =============================================================
# ADMINISTRATOR CHECK
# =============================================================
$Identity = [Security.Principal.WindowsIdentity]::GetCurrent()
$Principal = New-Object Security.Principal.WindowsPrincipal($Identity)
if (-not $Principal.IsInRole(
[Security.Principal.WindowsBuiltInRole]::Administrator
)) {
Write-Host "Run as Administrator!" -ForegroundColor Red
exit 1
}
Start-Transcript -Path $LogFile -Append
function Section($Name) {
Write-Host ""
Write-Host "==================================================" -ForegroundColor Cyan
Write-Host " $Name" -ForegroundColor Cyan
Write-Host "==================================================" -ForegroundColor Cyan
}
function Set-DwordValue {
param(
[string]$Path,
[string]$Name,
[int]$Value
)
try {
New-Item -Path $Path -Force | Out-Null
New-ItemProperty `
-Path $Path `
-Name $Name `
-PropertyType DWord `
-Value $Value `
-Force | Out-Null
}
catch {
Write-Warning "Registry error: $Name"
}
}
# =============================================================
# 1. BACKUP
# =============================================================
Section "1. SYSTEM BACKUP"
New-Item -Path $BackupDir -ItemType Directory -Force | Out-Null
if ($CreateRestorePoint) {
try {
Enable-ComputerRestore -Drive "$env:SystemDrive\"
Checkpoint-Computer `
-Description "Before_Ultimate_Debloat" `
-RestorePointType MODIFY_SETTINGS
Write-Host "Restore point created." -ForegroundColor Green
}
catch {
Write-Warning "Restore point unavailable. Continuing."
}
}
# Registry backups.
$RegistryKeys = @(
"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
"HKCU\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
"HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection",
"HKLM\SOFTWARE\Policies\Microsoft\Edge"
)
foreach ($Key in $RegistryKeys) {
$SafeName = $Key -replace '[\\/:*?"<>|]', '_'
reg.exe export $Key "$BackupDir\$SafeName.reg" /y 2>$null
}
# =============================================================
# 2. TELEMETRY
# =============================================================
Section "2. TELEMETRY"
# Minimum diagnostic data level available on common editions.
# Zero is not a supported setting on all Home/Pro editions.
Set-DwordValue `
"HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" `
"AllowTelemetry" 1
# Disable Customer Experience Improvement Program tasks.
$TaskNames = @(
"Consolidator",
"UsbCeip",
"KernelCeipTask"
)
$TaskFolder = "\Microsoft\Windows\Customer Experience Improvement Program\"
foreach ($Task in $TaskNames) {
try {
Disable-ScheduledTask `
-TaskPath $TaskFolder `
-TaskName $Task `
-ErrorAction SilentlyContinue | Out-Null
}
catch {}
}
# Restrict diagnostic tracking service.
try {
Stop-Service DiagTrack -Force -ErrorAction SilentlyContinue
Set-Service DiagTrack -StartupType Disabled
}
catch {
Write-Warning "DiagTrack could not be changed."
}
# =============================================================
# 3. WINDOWS ADVERTISING
# =============================================================
Section "3. ADVERTISING AND SUGGESTIONS"
$ContentPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"
$ContentValues = @(
"SystemPaneSuggestionsEnabled",
"SilentInstalledAppsEnabled",
"PreInstalledAppsEnabled",
"OemPreInstalledAppsEnabled",
"SoftLandingEnabled",
"RotatingLockScreenEnabled",
"RotatingLockScreenOverlayEnabled",
"SubscribedContent-338388Enabled",
"SubscribedContent-338389Enabled",
"SubscribedContent-353694Enabled",
"SubscribedContent-353696Enabled"
)
foreach ($Value in $ContentValues) {
Set-DwordValue $ContentPath $Value 0
}
Set-DwordValue `
"HKCU:\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo" `
"Enabled" 0
# Disable suggestions in Start.
Set-DwordValue `
"HKCU:\Software\Policies\Microsoft\Windows\Explorer" `
"HideRecommendedSection" 1
# =============================================================
# 4. MICROSOFT EDGE
# =============================================================
Section "4. MICROSOFT EDGE"
# Stop background activity and startup boost.
$EdgePolicy = "HKLM:\SOFTWARE\Policies\Microsoft\Edge"
$EdgeSettings = @{
BackgroundModeEnabled = 0
StartupBoostEnabled = 0
HubsSidebarEnabled = 0
ShowRecommendationsEnabled = 0
PersonalizationReportingEnabled = 0
EdgeShoppingAssistantEnabled = 0
SpotlightExperiencesAndRecommendationsEnabled = 0
}
foreach ($Setting in $EdgeSettings.GetEnumerator()) {
Set-DwordValue $EdgePolicy $Setting.Key $Setting.Value
}
# Remove the browser using its own installer.
# Do not remove the separate WebView2 runtime.
if ($RemoveEdge) {
$EdgeRoots = @(
"${env:ProgramFiles(x86)}\Microsoft\Edge\Application",
"$env:ProgramFiles\Microsoft\Edge\Application"
)
foreach ($Root in $EdgeRoots) {
if (-not (Test-Path $Root)) {
continue
}
$Installers = Get-ChildItem $Root -Directory -ErrorAction SilentlyContinue |
ForEach-Object {
Join-Path $_.FullName "Installer\setup.exe"
} |
Where-Object { Test-Path $_ }
foreach ($Installer in $Installers) {
Write-Host "Found Edge installer: $Installer"
try {
$Arguments = @(
"--uninstall",
"--system-level",
"--verbose-logging",
"--force-uninstall"
)
Start-Process `
-FilePath $Installer `
-ArgumentList $Arguments `
-Wait
Write-Host "Edge uninstall command executed."
}
catch {
Write-Warning "Edge removal was blocked or unsuccessful."
}
}
}
}
Write-Host "WebView2 runtime is intentionally preserved."
# =============================================================
# 5. WINDOWS DEFENDER
# =============================================================
Section "5. WINDOWS SECURITY"
# Defender remains enabled.
# Do not disable protected antivirus services or Tamper Protection.
# This preserves system security and Windows servicing.
Write-Host "Windows Defender preserved."
Write-Host "Security Center preserved."
# =============================================================
# 6. APPX DEBLOAT
# =============================================================
Section "6. REMOVE UNNECESSARY APPLICATIONS"
$AppsToRemove = @(
"Microsoft.BingNews",
"Microsoft.BingWeather",
"Microsoft.GetHelp",
"Microsoft.Getstarted",
"Microsoft.MicrosoftOfficeHub",
"Microsoft.MicrosoftSolitaireCollection",
"Microsoft.People",
"Microsoft.Todos",
"Microsoft.WindowsFeedbackHub",
"Microsoft.WindowsMaps",
"Microsoft.YourPhone",
"Microsoft.ZuneMusic",
"Microsoft.ZuneVideo",
"Microsoft.OutlookForWindows",
"Microsoft.MicrosoftTeams",
"MSTeams",
"Microsoft.Windows.Copilot",
"Microsoft.Copilot"
)
if ($RemoveXboxApps) {
$AppsToRemove += @(
"Microsoft.GamingApp",
"Microsoft.XboxGamingOverlay",
"Microsoft.XboxGameOverlay",
"Microsoft.XboxSpeechToTextOverlay"
)
}
foreach ($App in $AppsToRemove) {
Write-Host "Processing $App"
# Remove installed packages.
$Installed = Get-AppxPackage -AllUsers -Name $App `
-ErrorAction SilentlyContinue
foreach ($Package in $Installed) {
try {
Remove-AppxPackage `
-Package $Package.PackageFullName `
-AllUsers `
-ErrorAction Stop
}
catch {
Write-Warning "Could not remove installed package: $App"
}
}
# Remove provisioned package for future user profiles.
$Provisioned = Get-AppxProvisionedPackage -Online |
Where-Object { $_.DisplayName -eq $App }
foreach ($Package in $Provisioned) {
try {
Remove-AppxProvisionedPackage `
-Online `
-PackageName $Package.PackageName `
-ErrorAction Stop | Out-Null
}
catch {
Write-Warning "Could not remove provisioned package: $App"
}
}
}
# =============================================================
# 7. ONEDRIVE
# =============================================================
Section "7. ONEDRIVE"
if ($RemoveOneDrive) {
# Close OneDrive before uninstalling.
Stop-Process -Name OneDrive -Force -ErrorAction SilentlyContinue
$OneDrivePaths = @(
"$env:SystemRoot\SysWOW64\OneDriveSetup.exe",
"$env:SystemRoot\System32\OneDriveSetup.exe"
)
foreach ($Path in $OneDrivePaths) {
if (Test-Path $Path) {
try {
Start-Process $Path -ArgumentList "/uninstall" -Wait
}
catch {
Write-Warning "OneDrive uninstall failed."
}
}
}
}
# =============================================================
# 8. WIDGETS AND COPILOT INTERFACE
# =============================================================
Section "8. WIDGETS"
Set-DwordValue `
"HKLM:\SOFTWARE\Policies\Microsoft\Dsh" `
"AllowNewsAndInterests" 0
Set-DwordValue `
"HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsCopilot" `
"TurnOffWindowsCopilot" 1
Set-DwordValue `
"HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" `
"TaskbarDa" 0
# =============================================================
# 9. GAMING OPTIMIZATION
# =============================================================
Section "9. GAMING"
Set-DwordValue `
"HKCU:\System\GameConfigStore" `
"GameDVR_Enabled" 0
Set-DwordValue `
"HKLM:\SOFTWARE\Policies\Microsoft\Windows\GameDVR" `
"AllowGameDVR" 0
# Keep Game Mode and graphics driver services intact.
# =============================================================
# 10. EXPLORER
# =============================================================
Section "10. FILE EXPLORER"
$Advanced = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
# Hidden files.
Set-DwordValue $Advanced "Hidden" 1
# Protected system files.
Set-DwordValue $Advanced "ShowSuperHidden" 1
# File extensions.
Set-DwordValue $Advanced "HideFileExt" 0
# Open This PC.
Set-DwordValue $Advanced "LaunchTo" 1
# Classic context menu.
$ClassicMenu = "HKCU:\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32"
New-Item -Path $ClassicMenu -Force | Out-Null
Set-Item -Path $ClassicMenu -Value ""
# =============================================================
# 11. POWER PLAN
# =============================================================
Section "11. POWER PLAN"
# High Performance.
powercfg.exe /setactive SCHEME_MIN
# Disable hibernation.
powercfg.exe /hibernate off
# Keep page file automatically managed by Windows.
Write-Host "Page file configuration preserved."
# =============================================================
# 12. TEMPORARY FILES
# =============================================================
Section "12. TEMPORARY FILE CLEANUP"
if ($CleanTempFiles) {
$TempPaths = @(
$env:TEMP,
"$env:WINDIR\Temp"
)
foreach ($Path in $TempPaths) {
if (Test-Path $Path) {
Get-ChildItem -Path $Path -Force -ErrorAction SilentlyContinue |
ForEach-Object {
try {
Remove-Item $_.FullName -Recurse -Force `
-ErrorAction Stop
}
catch {
# Skip locked files.
}
}
}
}
}
# =============================================================
# 13. PROTECTED SERVICES VERIFICATION
# =============================================================
Section "13. PROTECTED SERVICES"
$ProtectedServices = @(
"Spooler",
"bthserv",
"WlanSvc",
"Dhcp",
"Dnscache",
"WinDefend",
"wuauserv",
"BITS"
)
foreach ($Service in $ProtectedServices) {
$Info = Get-CimInstance Win32_Service `
-Filter "Name='$Service'" `
-ErrorAction SilentlyContinue
if ($Info) {
Write-Host "$Service : $($Info.State) / $($Info.StartMode)"
}
}
# =============================================================
# 14. RESTART EXPLORER
# =============================================================
Section "14. RESTART EXPLORER"
Stop-Process -Name explorer -Force -ErrorAction SilentlyContinue
Start-Process explorer.exe
# =============================================================
# FINISH
# =============================================================
Section "OPTIMIZATION FINISHED"
Write-Host "Windows Update preserved."
Write-Host "Print Spooler preserved."
Write-Host "Bluetooth and Wi-Fi preserved."
Write-Host "Windows Defender preserved."
Write-Host "WebView2 preserved."
Write-Host "DirectX / .NET / VC++ untouched."
Write-Host ""
Write-Host "Log: $LogFile" -ForegroundColor Green
Write-Host "Backup: $BackupDir" -ForegroundColor Green
Stop-Transcript
Write-Host ""
Write-Host "REBOOT YOUR PC." -ForegroundColor Yellow
Read-Host "Press Enter to exit"