mirror of
https://github.com/Raphire/Win11Debloat.git
synced 2025-11-17 02:56:17 +00:00
144 lines
5.3 KiB
PowerShell
144 lines
5.3 KiB
PowerShell
param (
|
|
[switch]$Silent,
|
|
[switch]$Verbose,
|
|
[switch]$Sysprep,
|
|
[string]$LogPath,
|
|
[string]$User,
|
|
[switch]$CreateRestorePoint,
|
|
[switch]$RunAppsListGenerator, [switch]$RunAppConfigurator,
|
|
[switch]$RunDefaults,
|
|
[switch]$RunDefaultsLite,
|
|
[switch]$RunSavedSettings,
|
|
[switch]$RemoveApps,
|
|
[switch]$RemoveAppsCustom,
|
|
[switch]$RemoveGamingApps,
|
|
[switch]$RemoveCommApps,
|
|
[switch]$RemoveHPApps,
|
|
[switch]$RemoveW11Outlook,
|
|
[switch]$ForceRemoveEdge,
|
|
[switch]$DisableDVR,
|
|
[switch]$DisableTelemetry,
|
|
[switch]$DisableFastStartup,
|
|
[switch]$DisableModernStandbyNetworking,
|
|
[switch]$DisableBingSearches, [switch]$DisableBing,
|
|
[switch]$DisableDesktopSpotlight,
|
|
[switch]$DisableLockscrTips, [switch]$DisableLockscreenTips,
|
|
[switch]$DisableWindowsSuggestions, [switch]$DisableSuggestions,
|
|
[switch]$DisableEdgeAds,
|
|
[switch]$DisableSettings365Ads,
|
|
[switch]$DisableSettingsHome,
|
|
[switch]$ShowHiddenFolders,
|
|
[switch]$ShowKnownFileExt,
|
|
[switch]$HideDupliDrive,
|
|
[switch]$EnableDarkMode,
|
|
[switch]$DisableTransparency,
|
|
[switch]$DisableAnimations,
|
|
[switch]$TaskbarAlignLeft,
|
|
[switch]$CombineTaskbarAlways, [switch]$CombineTaskbarWhenFull, [switch]$CombineTaskbarNever,
|
|
[switch]$CombineMMTaskbarAlways, [switch]$CombineMMTaskbarWhenFull, [switch]$CombineMMTaskbarNever,
|
|
[switch]$MMTaskbarModeAll, [switch]$MMTaskbarModeMainActive, [switch]$MMTaskbarModeActive,
|
|
[switch]$HideSearchTb, [switch]$ShowSearchIconTb, [switch]$ShowSearchLabelTb, [switch]$ShowSearchBoxTb,
|
|
[switch]$HideTaskview,
|
|
[switch]$DisableStartRecommended,
|
|
[switch]$DisableStartPhoneLink,
|
|
[switch]$DisableCopilot,
|
|
[switch]$DisableRecall,
|
|
[switch]$DisableClickToDo,
|
|
[switch]$DisablePaintAI,
|
|
[switch]$DisableNotepadAI,
|
|
[switch]$DisableEdgeAI,
|
|
[switch]$DisableWidgets, [switch]$HideWidgets,
|
|
[switch]$DisableChat, [switch]$HideChat,
|
|
[switch]$EnableEndTask,
|
|
[switch]$EnableLastActiveClick,
|
|
[switch]$ClearStart,
|
|
[string]$ReplaceStart,
|
|
[switch]$ClearStartAllUsers,
|
|
[string]$ReplaceStartAllUsers,
|
|
[switch]$RevertContextMenu,
|
|
[switch]$DisableMouseAcceleration,
|
|
[switch]$DisableStickyKeys,
|
|
[switch]$HideHome,
|
|
[switch]$HideGallery,
|
|
[switch]$ExplorerToHome,
|
|
[switch]$ExplorerToThisPC,
|
|
[switch]$ExplorerToDownloads,
|
|
[switch]$ExplorerToOneDrive,
|
|
[switch]$DisableOnedrive, [switch]$HideOnedrive,
|
|
[switch]$Disable3dObjects, [switch]$Hide3dObjects,
|
|
[switch]$DisableMusic, [switch]$HideMusic,
|
|
[switch]$DisableIncludeInLibrary, [switch]$HideIncludeInLibrary,
|
|
[switch]$DisableGiveAccessTo, [switch]$HideGiveAccessTo,
|
|
[switch]$DisableShare, [switch]$HideShare
|
|
)
|
|
|
|
# Show error if current powershell environment does not have LanguageMode set to FullLanguage
|
|
if ($ExecutionContext.SessionState.LanguageMode -ne "FullLanguage") {
|
|
Write-Host "Error: Win11Debloat is unable to run on your system. PowerShell execution is restricted by security policies" -ForegroundColor Red
|
|
Write-Output ""
|
|
Write-Output "Press enter to exit..."
|
|
Read-Host | Out-Null
|
|
Exit
|
|
}
|
|
|
|
Clear-Host
|
|
Write-Output "-------------------------------------------------------------------------------------------"
|
|
Write-Output " Win11Debloat Script - Get"
|
|
Write-Output "-------------------------------------------------------------------------------------------"
|
|
|
|
Write-Output "> Downloading Win11Debloat..."
|
|
|
|
# Download latest version of Win11Debloat from github as zip archive
|
|
Invoke-RestMethod https://api.github.com/repos/Raphire/Win11Debloat/zipball/2025.09.28 -OutFile "$env:TEMP/win11debloat.zip"
|
|
|
|
# Remove old script folder if it exists, except for CustomAppsList and SavedSettings files
|
|
if (Test-Path "$env:TEMP/Win11Debloat") {
|
|
Write-Output ""
|
|
Write-Output "> Cleaning up old Win11Debloat folder..."
|
|
Get-ChildItem -Path "$env:TEMP/Win11Debloat" -Exclude CustomAppsList,SavedSettings,Win11Debloat.log | Remove-Item -Recurse -Force
|
|
}
|
|
|
|
Write-Output ""
|
|
Write-Output "> Unpacking..."
|
|
|
|
# Unzip archive to Win11Debloat folder
|
|
Expand-Archive "$env:TEMP/win11debloat.zip" "$env:TEMP/Win11Debloat"
|
|
|
|
# Remove archive
|
|
Remove-Item "$env:TEMP/win11debloat.zip"
|
|
|
|
# Move files
|
|
Get-ChildItem -Path "$env:TEMP/Win11Debloat/Raphire-Win11Debloat-*" -Recurse | Move-Item -Destination "$env:TEMP/Win11Debloat"
|
|
|
|
# Make list of arguments to pass on to the script
|
|
$arguments = $($PSBoundParameters.GetEnumerator() | ForEach-Object {
|
|
if ($_.Value -eq $true) {
|
|
"-$($_.Key)"
|
|
}
|
|
else {
|
|
"-$($_.Key) ""$($_.Value)"""
|
|
}
|
|
})
|
|
|
|
Write-Output ""
|
|
Write-Output "> Running Win11Debloat..."
|
|
|
|
# Run Win11Debloat script with the provided arguments
|
|
$debloatProcess = Start-Process powershell.exe -PassThru -ArgumentList "-executionpolicy bypass -File $env:TEMP\Win11Debloat\Win11Debloat.ps1 $arguments" -Verb RunAs
|
|
|
|
# Wait for the process to finish before continuing
|
|
if ($null -ne $debloatProcess) {
|
|
$debloatProcess.WaitForExit()
|
|
}
|
|
|
|
# Remove all remaining script files, except for CustomAppsList and SavedSettings files
|
|
if (Test-Path "$env:TEMP/Win11Debloat") {
|
|
Write-Output ""
|
|
Write-Output "> Cleaning up..."
|
|
|
|
# Cleanup, remove Win11Debloat directory
|
|
Get-ChildItem -Path "$env:TEMP/Win11Debloat" -Exclude CustomAppsList,SavedSettings,Win11Debloat.log | Remove-Item -Recurse -Force
|
|
}
|
|
|
|
Write-Output ""
|