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 ,
2026-02-01 01:41:12 +01:00
[ switch ] $RunAppsListGenerator ,
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 ] $RemoveAppsCustom ,
[ switch ] $RemoveGamingApps ,
[ switch ] $RemoveCommApps ,
2025-05-04 12:27:19 -04:00
[ switch ] $RemoveHPApps ,
2024-05-20 13:09:08 +02:00
[ switch ] $RemoveW11Outlook ,
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-03-09 23:03:56 +01:00
[ switch ] $DisableStartAllApps ,
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 " ------------------------------------------------------------------------------------------- "
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
Invoke-RestMethod $LatestReleaseUri -OutFile " $env:TEMP /win11debloat.zip "
}
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-03-09 23:50:50 +01:00
Write-Output " "
Write-Output " > Cleaning up old Win11Debloat folder... "
# Remove old script folder if it exists, but keep config and log files
2025-05-19 20:30:11 +02:00
if ( Test-Path " $env:TEMP /Win11Debloat " ) {
2026-03-09 23:50:50 +01:00
Get-ChildItem -Path " $env:TEMP /Win11Debloat " -Exclude CustomAppsList , LastUsedSettings . json , Win11Debloat . log , Config , Logs | Remove-Item -Recurse -Force
}
$configDir = " $env:TEMP /Win11Debloat/Config "
$backupDir = " $env:TEMP /Win11Debloat/ConfigOld "
# Temporarily move existing config files if they exist to prevent them from being overwritten by the new script files, will be moved back after the new script is unpacked
if ( Test-Path " $configDir " ) {
New-Item -ItemType Directory -Path " $backupDir " -Force | Out-Null
$filesToKeep = @ (
'CustomAppsList' ,
'LastUsedSettings.json'
)
Get-ChildItem -Path " $configDir " -Recurse | Where-Object { $_ . Name -in $filesToKeep } | Move-Item -Destination " $backupDir "
Remove-Item " $configDir " -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
2025-06-12 22:05:44 +02:00
Expand-Archive " $env:TEMP /win11debloat.zip " " $env:TEMP /Win11Debloat "
2024-05-20 13:09:08 +02:00
2024-06-15 01:01:47 +02:00
# Remove archive
2025-06-12 22:05:44 +02:00
Remove-Item " $env:TEMP /win11debloat.zip "
2024-05-20 13:09:08 +02:00
2025-05-19 20:30:11 +02:00
# Move files
Get-ChildItem -Path " $env:TEMP /Win11Debloat/Raphire-Win11Debloat-* " -Recurse | Move-Item -Destination " $env:TEMP /Win11Debloat "
2026-03-09 23:50:50 +01:00
# Add existing config files back to Config folder
if ( Test-Path " $backupDir " ) {
if ( -not ( Test-Path " $configDir " ) ) {
New-Item -ItemType Directory -Path " $configDir " -Force | Out-Null
}
Get-ChildItem -Path " $backupDir " -Recurse | Move-Item -Destination " $configDir "
Remove-Item " $backupDir " -Recurse -Force
}
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 " "
2024-06-16 00:09:00 +02:00
Write-Output " > Running 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-03-09 23:21:22 +01:00
$debloatProcess = Start-Process powershell . exe -WindowStyle $windowStyle -PassThru -ArgumentList " -executionpolicy bypass -File $env:TEMP \Win11Debloat\Win11Debloat.ps1 $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
2025-12-26 20:36:51 +01:00
# Remove all remaining script files, except for CustomAppsList and LastUsedSettings.json files
2025-05-19 20:30:11 +02:00
if ( Test-Path " $env:TEMP /Win11Debloat " ) {
2024-09-29 12:32:07 +02:00
Write-Output " "
Write-Output " > Cleaning up... "
2024-06-15 01:01:47 +02:00
2024-09-29 12:32:07 +02:00
# Cleanup, remove Win11Debloat directory
2026-03-15 22:58:06 +01:00
Get-ChildItem -Path " $env:TEMP /Win11Debloat " -Exclude CustomAppsList , LastUsedSettings . json , Win11Debloat . log , Win11Debloat-Run . log , Config , Logs | Remove-Item -Recurse -Force
2024-09-29 12:32:07 +02:00
}
2024-06-16 00:09:00 +02:00
Write-Output " "