2024-05-20 13:09:08 +02:00
|
|
|
param (
|
2026-02-01 01:41:12 +01:00
|
|
|
[switch]$CLI,
|
2024-05-20 13:09:08 +02:00
|
|
|
[switch]$Silent,
|
2024-08-17 00:08:09 +02:00
|
|
|
[switch]$Verbose,
|
2024-06-27 23:08:43 +02:00
|
|
|
[switch]$Sysprep,
|
2025-05-10 13:02:48 +02:00
|
|
|
[string]$LogPath,
|
2025-03-05 23:39:29 +01:00
|
|
|
[string]$User,
|
2025-12-29 01:03:14 +01:00
|
|
|
[switch]$NoRestartExplorer,
|
2025-05-03 17:55:31 +02:00
|
|
|
[switch]$CreateRestorePoint,
|
2025-09-13 23:36:38 +02:00
|
|
|
[switch]$RunDefaults,
|
|
|
|
|
[switch]$RunDefaultsLite,
|
2025-01-09 21:33:28 +01:00
|
|
|
[switch]$RunSavedSettings,
|
2026-03-27 20:33:24 +01:00
|
|
|
[string]$Config,
|
2025-12-26 20:36:51 +01:00
|
|
|
[string]$Apps,
|
2026-02-12 22:50:22 +01:00
|
|
|
[string]$AppRemovalTarget,
|
2025-12-26 20:36:51 +01:00
|
|
|
[switch]$RemoveApps,
|
2024-05-20 13:09:08 +02:00
|
|
|
[switch]$RemoveGamingApps,
|
2025-05-04 12:27:19 -04:00
|
|
|
[switch]$RemoveHPApps,
|
2024-07-02 18:51:00 +02:00
|
|
|
[switch]$ForceRemoveEdge,
|
2024-05-24 14:13:15 +02:00
|
|
|
[switch]$DisableDVR,
|
2025-11-29 17:15:12 +01:00
|
|
|
[switch]$DisableGameBarIntegration,
|
2026-02-18 19:00:49 +01:00
|
|
|
[switch]$EnableWindowsSandbox,
|
|
|
|
|
[switch]$EnableWindowsSubsystemForLinux,
|
2024-05-20 13:09:08 +02:00
|
|
|
[switch]$DisableTelemetry,
|
2026-02-18 19:00:49 +01:00
|
|
|
[switch]$DisableSearchHistory,
|
2025-05-01 22:32:41 +01:00
|
|
|
[switch]$DisableFastStartup,
|
2026-02-04 13:59:10 +01:00
|
|
|
[switch]$DisableBitlockerAutoEncryption,
|
2025-08-19 23:24:28 +05:30
|
|
|
[switch]$DisableModernStandbyNetworking,
|
2026-03-07 20:29:08 +01:00
|
|
|
[switch]$DisableStorageSense,
|
2026-02-04 14:01:04 +01:00
|
|
|
[switch]$DisableUpdateASAP,
|
|
|
|
|
[switch]$PreventUpdateAutoReboot,
|
|
|
|
|
[switch]$DisableDeliveryOptimization,
|
2026-02-01 01:41:12 +01:00
|
|
|
[switch]$DisableBing,
|
2026-03-07 20:28:48 +01:00
|
|
|
[switch]$DisableStoreSearchSuggestions,
|
2024-12-26 19:06:49 +01:00
|
|
|
[switch]$DisableDesktopSpotlight,
|
2026-02-01 01:41:12 +01:00
|
|
|
[switch]$DisableLockscreenTips,
|
|
|
|
|
[switch]$DisableSuggestions,
|
2026-02-18 20:53:53 +01:00
|
|
|
[switch]$DisableLocationServices,
|
2026-03-07 18:32:06 +00:00
|
|
|
[switch]$DisableFindMyDevice,
|
2025-08-16 01:36:00 +02:00
|
|
|
[switch]$DisableEdgeAds,
|
2026-02-01 01:41:12 +01:00
|
|
|
[switch]$DisableBraveBloat,
|
2025-05-20 21:55:38 +02:00
|
|
|
[switch]$DisableSettings365Ads,
|
2025-05-20 21:56:04 +02:00
|
|
|
[switch]$DisableSettingsHome,
|
2024-05-20 13:09:08 +02:00
|
|
|
[switch]$ShowHiddenFolders,
|
|
|
|
|
[switch]$ShowKnownFileExt,
|
|
|
|
|
[switch]$HideDupliDrive,
|
2025-06-12 21:50:57 +02:00
|
|
|
[switch]$EnableDarkMode,
|
|
|
|
|
[switch]$DisableTransparency,
|
|
|
|
|
[switch]$DisableAnimations,
|
2024-05-20 13:09:08 +02:00
|
|
|
[switch]$TaskbarAlignLeft,
|
2025-09-27 14:34:01 +02:00
|
|
|
[switch]$CombineTaskbarAlways, [switch]$CombineTaskbarWhenFull, [switch]$CombineTaskbarNever,
|
2025-10-06 23:33:04 +02:00
|
|
|
[switch]$CombineMMTaskbarAlways, [switch]$CombineMMTaskbarWhenFull, [switch]$CombineMMTaskbarNever,
|
|
|
|
|
[switch]$MMTaskbarModeAll, [switch]$MMTaskbarModeMainActive, [switch]$MMTaskbarModeActive,
|
2024-05-20 13:09:08 +02:00
|
|
|
[switch]$HideSearchTb, [switch]$ShowSearchIconTb, [switch]$ShowSearchLabelTb, [switch]$ShowSearchBoxTb,
|
|
|
|
|
[switch]$HideTaskview,
|
2025-02-03 21:27:46 +01:00
|
|
|
[switch]$DisableStartRecommended,
|
2026-06-10 17:40:31 +02:00
|
|
|
[switch]$DisableStartAllApps, [switch]$StartAllAppsCategory, [switch]$StartAllAppsGrid, [switch]$StartAllAppsList,
|
2025-06-11 22:04:17 +02:00
|
|
|
[switch]$DisableStartPhoneLink,
|
2024-05-20 13:09:08 +02:00
|
|
|
[switch]$DisableCopilot,
|
2024-06-05 09:17:24 +02:00
|
|
|
[switch]$DisableRecall,
|
2025-09-17 23:33:52 +02:00
|
|
|
[switch]$DisableClickToDo,
|
2026-03-07 20:28:58 +01:00
|
|
|
[switch]$DisableAISvcAutoStart,
|
2025-08-01 21:21:38 +02:00
|
|
|
[switch]$DisablePaintAI,
|
|
|
|
|
[switch]$DisableNotepadAI,
|
2025-08-16 01:36:00 +02:00
|
|
|
[switch]$DisableEdgeAI,
|
2026-03-07 18:32:06 +00:00
|
|
|
[switch]$DisableSearchHighlights,
|
2026-02-01 01:41:12 +01:00
|
|
|
[switch]$DisableWidgets,
|
|
|
|
|
[switch]$HideChat,
|
2025-04-16 12:31:18 +02:00
|
|
|
[switch]$EnableEndTask,
|
2025-07-30 15:30:51 -04:00
|
|
|
[switch]$EnableLastActiveClick,
|
2024-05-20 13:09:08 +02:00
|
|
|
[switch]$ClearStart,
|
2025-05-19 00:01:49 +02:00
|
|
|
[string]$ReplaceStart,
|
2024-06-28 16:54:35 +02:00
|
|
|
[switch]$ClearStartAllUsers,
|
2025-05-19 00:01:49 +02:00
|
|
|
[string]$ReplaceStartAllUsers,
|
2024-05-20 13:09:08 +02:00
|
|
|
[switch]$RevertContextMenu,
|
2026-02-01 01:41:12 +01:00
|
|
|
[switch]$DisableDragTray,
|
2025-02-13 21:08:47 +01:00
|
|
|
[switch]$DisableMouseAcceleration,
|
2025-04-16 12:56:37 +02:00
|
|
|
[switch]$DisableStickyKeys,
|
2026-02-12 23:14:15 +01:00
|
|
|
[switch]$DisableWindowSnapping,
|
|
|
|
|
[switch]$DisableSnapAssist,
|
|
|
|
|
[switch]$DisableSnapLayouts,
|
|
|
|
|
[switch]$HideTabsInAltTab, [switch]$Show3TabsInAltTab, [switch]$Show5TabsInAltTab, [switch]$Show20TabsInAltTab,
|
2024-09-04 17:46:41 +02:00
|
|
|
[switch]$HideHome,
|
2024-06-29 16:18:23 +02:00
|
|
|
[switch]$HideGallery,
|
2024-10-27 19:28:43 +01:00
|
|
|
[switch]$ExplorerToHome,
|
|
|
|
|
[switch]$ExplorerToThisPC,
|
|
|
|
|
[switch]$ExplorerToDownloads,
|
|
|
|
|
[switch]$ExplorerToOneDrive,
|
2025-12-29 01:03:14 +01:00
|
|
|
[switch]$AddFoldersToThisPC,
|
2026-02-01 01:41:12 +01:00
|
|
|
[switch]$HideOnedrive,
|
|
|
|
|
[switch]$Hide3dObjects,
|
|
|
|
|
[switch]$HideMusic,
|
|
|
|
|
[switch]$HideIncludeInLibrary,
|
|
|
|
|
[switch]$HideGiveAccessTo,
|
2026-03-28 20:25:12 -03:00
|
|
|
[switch]$HideShare,
|
|
|
|
|
[switch]$ShowDriveLettersFirst,
|
|
|
|
|
[switch]$ShowDriveLettersLast,
|
|
|
|
|
[switch]$ShowNetworkDriveLettersFirst,
|
|
|
|
|
[switch]$HideDriveLetters
|
2024-05-20 13:09:08 +02:00
|
|
|
)
|
|
|
|
|
|
2024-06-26 20:27:25 +02:00
|
|
|
# Show error if current powershell environment does not have LanguageMode set to FullLanguage
|
|
|
|
|
if ($ExecutionContext.SessionState.LanguageMode -ne "FullLanguage") {
|
2025-05-25 20:25:06 +02:00
|
|
|
Write-Host "Error: Win11Debloat is unable to run on your system. PowerShell execution is restricted by security policies" -ForegroundColor Red
|
2024-06-26 20:27:25 +02:00
|
|
|
Write-Output ""
|
|
|
|
|
Write-Output "Press enter to exit..."
|
|
|
|
|
Read-Host | Out-Null
|
|
|
|
|
Exit
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-20 14:13:14 +02:00
|
|
|
Clear-Host
|
|
|
|
|
Write-Output "-------------------------------------------------------------------------------------------"
|
|
|
|
|
Write-Output " Win11Debloat Script - Get"
|
|
|
|
|
Write-Output "-------------------------------------------------------------------------------------------"
|
|
|
|
|
|
2026-05-08 21:19:52 +02:00
|
|
|
$tempRootPath = $env:TEMP
|
|
|
|
|
$tempWorkPath = Join-Path $tempRootPath 'Win11Debloat'
|
|
|
|
|
$tempArchivePath = Join-Path $tempRootPath 'win11debloat.zip'
|
|
|
|
|
|
2024-06-15 01:01:47 +02:00
|
|
|
Write-Output "> Downloading Win11Debloat..."
|
2024-05-20 13:09:08 +02:00
|
|
|
|
2025-12-01 21:04:39 +01:00
|
|
|
# Download latest version of Win11Debloat from GitHub as zip archive
|
|
|
|
|
try {
|
|
|
|
|
$LatestReleaseUri = (Invoke-RestMethod https://api.github.com/repos/Raphire/Win11Debloat/releases/latest).zipball_url
|
2026-05-08 21:19:52 +02:00
|
|
|
Invoke-RestMethod $LatestReleaseUri -OutFile $tempArchivePath
|
2025-12-01 21:04:39 +01:00
|
|
|
}
|
|
|
|
|
catch {
|
|
|
|
|
Write-Host "Error: Unable to fetch latest release from GitHub. Please check your internet connection and try again." -ForegroundColor Red
|
|
|
|
|
Write-Output ""
|
|
|
|
|
Write-Output "Press enter to exit..."
|
|
|
|
|
Read-Host | Out-Null
|
|
|
|
|
Exit
|
|
|
|
|
}
|
2024-06-16 00:09:00 +02:00
|
|
|
|
2026-06-23 01:18:32 +02:00
|
|
|
# Migrate old user data from previous runs to AppData before cleanup
|
2026-05-08 21:19:52 +02:00
|
|
|
if (Test-Path $tempWorkPath) {
|
2026-06-23 01:18:32 +02:00
|
|
|
$appDataPath = Join-Path $env:LOCALAPPDATA 'Win11Debloat'
|
|
|
|
|
if (-not (Test-Path $appDataPath)) { New-Item -ItemType Directory -Path $appDataPath -Force | Out-Null }
|
|
|
|
|
|
|
|
|
|
$oldBackupsDir = Join-Path $tempWorkPath 'Backups'
|
|
|
|
|
$oldLogsDir = Join-Path $tempWorkPath 'Logs'
|
|
|
|
|
$oldSettingsFile = Join-Path $tempWorkPath 'Config\LastUsedSettings.json'
|
|
|
|
|
|
|
|
|
|
if ((Test-Path $oldBackupsDir) -and (Get-ChildItem -Path $oldBackupsDir -ErrorAction SilentlyContinue)) {
|
|
|
|
|
$newBackupsDir = Join-Path $appDataPath 'Backups'
|
|
|
|
|
if (-not (Test-Path $newBackupsDir)) { New-Item -ItemType Directory -Path $newBackupsDir -Force | Out-Null }
|
|
|
|
|
Get-ChildItem -Path $oldBackupsDir | Move-Item -Destination $newBackupsDir -Force -ErrorAction SilentlyContinue
|
|
|
|
|
}
|
|
|
|
|
if ((Test-Path $oldLogsDir) -and (Get-ChildItem -Path $oldLogsDir -ErrorAction SilentlyContinue)) {
|
|
|
|
|
$newLogsDir = Join-Path $appDataPath 'Logs'
|
|
|
|
|
if (-not (Test-Path $newLogsDir)) { New-Item -ItemType Directory -Path $newLogsDir -Force | Out-Null }
|
|
|
|
|
Get-ChildItem -Path $oldLogsDir | Move-Item -Destination $newLogsDir -Force -ErrorAction SilentlyContinue
|
|
|
|
|
}
|
|
|
|
|
if (Test-Path $oldSettingsFile) {
|
|
|
|
|
Move-Item -Path $oldSettingsFile -Destination $appDataPath -Force -ErrorAction SilentlyContinue
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-25 14:35:39 +02:00
|
|
|
Write-Output ""
|
|
|
|
|
Write-Output "> Cleaning up old Win11Debloat folder..."
|
|
|
|
|
|
2026-06-23 01:04:29 +02:00
|
|
|
Remove-Item $tempWorkPath -Recurse -Force
|
2024-06-16 00:09:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Write-Output ""
|
|
|
|
|
Write-Output "> Unpacking..."
|
2024-05-20 13:09:08 +02:00
|
|
|
|
2024-06-15 01:01:47 +02:00
|
|
|
# Unzip archive to Win11Debloat folder
|
2026-05-08 21:19:52 +02:00
|
|
|
Expand-Archive $tempArchivePath $tempWorkPath
|
2024-05-20 13:09:08 +02:00
|
|
|
|
2024-06-15 01:01:47 +02:00
|
|
|
# Remove archive
|
2026-05-08 21:19:52 +02:00
|
|
|
Remove-Item $tempArchivePath
|
2024-05-20 13:09:08 +02:00
|
|
|
|
2025-05-19 20:30:11 +02:00
|
|
|
# Move files
|
2026-06-10 17:40:31 +02:00
|
|
|
Get-ChildItem -Path (Join-Path $tempWorkPath '*Win11Debloat-*') -Recurse | Move-Item -Destination $tempWorkPath
|
2025-05-19 20:30:11 +02:00
|
|
|
|
2024-06-15 01:01:47 +02:00
|
|
|
# Make list of arguments to pass on to the script
|
2025-03-06 00:01:04 +01:00
|
|
|
$arguments = $($PSBoundParameters.GetEnumerator() | ForEach-Object {
|
|
|
|
|
if ($_.Value -eq $true) {
|
|
|
|
|
"-$($_.Key)"
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
"-$($_.Key) ""$($_.Value)"""
|
|
|
|
|
}
|
|
|
|
|
})
|
2024-05-20 14:13:14 +02:00
|
|
|
|
2024-06-15 01:01:47 +02:00
|
|
|
Write-Output ""
|
2026-04-19 19:54:45 +02:00
|
|
|
Write-Output "> Launching Win11Debloat..."
|
2024-05-20 13:09:08 +02:00
|
|
|
|
2026-02-01 13:40:22 +01:00
|
|
|
# Minimize the powershell window when no parameters are provided
|
|
|
|
|
if ($arguments.Count -eq 0) {
|
2026-02-01 13:37:27 +01:00
|
|
|
$windowStyle = "Minimized"
|
2026-02-01 13:40:22 +01:00
|
|
|
}
|
|
|
|
|
else {
|
2026-02-01 13:37:27 +01:00
|
|
|
$windowStyle = "Normal"
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 23:21:22 +01:00
|
|
|
# Remove Powershell 7 modules from path to prevent module loading issues in the script
|
2026-03-09 22:49:07 +01:00
|
|
|
if ($PSVersionTable.PSVersion.Major -ge 7) {
|
2026-03-09 23:21:22 +01:00
|
|
|
$NewPSModulePath = $env:PSModulePath -split ';' | Where-Object -FilterScript { $_ -like '*WindowsPowerShell*' }
|
|
|
|
|
$env:PSModulePath = $NewPSModulePath -join ';'
|
2026-03-09 22:49:07 +01:00
|
|
|
}
|
|
|
|
|
|
2024-06-15 01:01:47 +02:00
|
|
|
# Run Win11Debloat script with the provided arguments
|
2026-05-08 21:19:52 +02:00
|
|
|
$debloatScriptPath = Join-Path $tempWorkPath 'Win11Debloat.ps1'
|
|
|
|
|
$debloatProcess = Start-Process powershell.exe -WindowStyle $windowStyle -PassThru -ArgumentList "-executionpolicy bypass -File `"$debloatScriptPath`" $arguments" -Verb RunAs
|
2024-07-02 18:51:00 +02:00
|
|
|
|
|
|
|
|
# Wait for the process to finish before continuing
|
2024-08-17 00:08:09 +02:00
|
|
|
if ($null -ne $debloatProcess) {
|
2024-07-02 18:51:00 +02:00
|
|
|
$debloatProcess.WaitForExit()
|
|
|
|
|
}
|
2024-05-20 14:13:14 +02:00
|
|
|
|
2026-06-23 01:04:29 +02:00
|
|
|
# Remove all remaining script files
|
2026-05-08 21:19:52 +02:00
|
|
|
if (Test-Path $tempWorkPath) {
|
2024-09-29 12:32:07 +02:00
|
|
|
Write-Output ""
|
|
|
|
|
Write-Output "> Cleaning up..."
|
2024-06-15 01:01:47 +02:00
|
|
|
|
2026-06-23 01:04:29 +02:00
|
|
|
Remove-Item $tempWorkPath -Recurse -Force
|
2024-09-29 12:32:07 +02:00
|
|
|
}
|
2024-06-16 00:09:00 +02:00
|
|
|
|
|
|
|
|
Write-Output ""
|