Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ------------------------------------------------------------
- # WINDOWS 11 RESTORATION SCRIPT
- # PURPOSE: Revert all system changes made by optimization script
- # Compatible with: Optimize-Windows11.ps1
- # ------------------------------------------------------------
- # Description:
- # This PowerShell script restores Windows 11 to its default state
- # by re-enabling essential services, restoring system apps,
- # reactivating telemetry, and returning to the balanced power plan.
- # It is designed to fully undo all optimizations applied by
- # the "Optimize-Windows11.ps1" script.
- #
- # How to Run:
- # 1. Save this file as "Restore-Windows11.ps1".
- # 2. Open PowerShell as Administrator and run: Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
- # 3. Right-click the file and select "Run with PowerShell".
- # (Or open PowerShell as Administrator and execute it manually.)
- # 4. If script execution is blocked, run:
- # Set-ExecutionPolicy Bypass -Scope Process -Force
- # 5. Once completed, restart your PC to apply all changes.
- # ------------------------------------------------------------
- Write-Host "Starting restoration of Windows 11 default configuration..." -ForegroundColor Cyan
- # 1. Restore essential services
- $services = @(
- "SysMain",
- "DiagTrack",
- "WSearch",
- "WerSvc",
- "RemoteRegistry",
- "Fax",
- "RetailDemo",
- "MapsBroker",
- "SharedAccess",
- "BluetoothSupportService",
- "OneSyncSvc",
- "PhoneSvc",
- "CDPUserSvc",
- "edgeupdate",
- "edgeupdatem"
- )
- foreach ($service in $services) {
- Get-Service -Name $service -ErrorAction SilentlyContinue | ForEach-Object {
- Set-Service -Name $_.Name -StartupType Automatic
- Start-Service -Name $_.Name -ErrorAction SilentlyContinue
- Write-Host "Service restored: $($_.Name)"
- }
- }
- # 2. Re-enable telemetry and diagnostic tasks
- Write-Host "Re-enabling telemetry tasks..." -ForegroundColor Yellow
- $tasks = @(
- "\Microsoft\Windows\Application Experience\ProgramDataUpdater",
- "\Microsoft\Windows\Customer Experience Improvement Program\Consolidator",
- "\Microsoft\Windows\Customer Experience Improvement Program\UsbCeip",
- "\Microsoft\Windows\DiskDiagnostic\Microsoft-Windows-DiskDiagnosticDataCollector",
- "\Microsoft\Windows\Feedback\Siuf\DmClient",
- "\Microsoft\Windows\Feedback\Siuf\DmClientOnScenarioDownload"
- )
- foreach ($task in $tasks) {
- schtasks /Change /TN $task /Enable 2>$null
- }
- # 3. Reinstall OneDrive
- Write-Host "Reinstalling OneDrive..." -ForegroundColor Yellow
- & "$env:SystemRoot\System32\OneDriveSetup.exe" /install
- Write-Host "OneDrive restored."
- # 4. Re-enable Cortana and Widgets
- Write-Host "Re-enabling Cortana and Widgets..." -ForegroundColor Yellow
- reg delete "HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v AllowCortana /f
- reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Feeds" /v ShellFeedsTaskbarViewMode /f
- reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Feeds" /v EnableFeeds /f
- # 5. Re-enable Edge AutoUpdate
- Write-Host "Re-enabling Edge automatic updates..." -ForegroundColor Yellow
- reg delete "HKLM\SOFTWARE\Policies\Microsoft\EdgeUpdate" /f
- # 6. Restore power plan to Balanced
- Write-Host "Restoring Balanced power plan..." -ForegroundColor Yellow
- powercfg -setactive SCHEME_BALANCED
- powercfg -change -monitor-timeout-ac 10
- powercfg -change -disk-timeout-ac 20
- powercfg -change -standby-timeout-ac 30
- powercfg -hibernate on
- # 7. Restore default visual effects
- Write-Host "Re-enabling visual effects and animations..." -ForegroundColor Yellow
- Set-ItemProperty "HKCU:\Control Panel\Desktop" "UserPreferencesMask" ([byte[]](0x9E,0x1E,0x07,0x80,0x12,0x00,0x00,0x00))
- Set-ItemProperty "HKCU:\Control Panel\Desktop\WindowMetrics" MinAnimate 1
- Set-ItemProperty "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects" VisualFXSetting 1
- Set-ItemProperty "HKCU:\Software\Microsoft\Windows\DWM" EnableAeroPeek 1
- Set-ItemProperty "HKCU:\Software\Microsoft\Windows\DWM" EnableBlurBehind 1
- # 8. Restore Delivery Optimization and network settings
- Write-Host "Restoring Delivery Optimization and network configuration..." -ForegroundColor Yellow
- Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" -Name DODownloadMode -Value 1 -Force
- netsh int tcp set global autotuninglevel=normal
- netsh int tcp set global rss=default
- netsh int tcp set global chimney=default
- # 9. Reinstall system apps (requires Microsoft Store)
- Write-Host "Reinstalling system apps (Microsoft Store required)..." -ForegroundColor Yellow
- Get-AppxPackage -AllUsers | ForEach-Object {
- Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppxManifest.xml" -ErrorAction SilentlyContinue
- }
- # 10. Restore Windows Defender default settings
- Write-Host "Restoring Windows Defender default settings..." -ForegroundColor Yellow
- Set-MpPreference -MAPSReporting 1 -ErrorAction SilentlyContinue
- Set-MpPreference -SubmitSamplesConsent 1 -ErrorAction SilentlyContinue
- Set-MpPreference -PUAProtection Enabled -ErrorAction SilentlyContinue
- # Finalization
- Write-Host "System restoration completed successfully." -ForegroundColor Cyan
- Write-Host "Restart your PC to apply all changes." -ForegroundColor Green
Advertisement
Add Comment
Please, Sign In to add comment