2024-05-20 13:09:08 +02:00
|
|
|
param (
|
|
|
|
|
[switch]$Silent,
|
2024-08-17 00:08:09 +02:00
|
|
|
[switch]$Verbose,
|
2024-06-27 23:08:43 +02:00
|
|
|
[switch]$Sysprep,
|
2024-05-20 13:09:08 +02:00
|
|
|
[switch]$RunAppConfigurator,
|
|
|
|
|
[switch]$RunDefaults, [switch]$RunWin11Defaults,
|
|
|
|
|
[switch]$RemoveApps,
|
|
|
|
|
[switch]$RemoveAppsCustom,
|
|
|
|
|
[switch]$RemoveGamingApps,
|
|
|
|
|
[switch]$RemoveCommApps,
|
|
|
|
|
[switch]$RemoveDevApps,
|
|
|
|
|
[switch]$RemoveW11Outlook,
|
2024-07-02 18:51:00 +02:00
|
|
|
[switch]$ForceRemoveEdge,
|
2024-05-24 14:13:15 +02:00
|
|
|
[switch]$DisableDVR,
|
2024-05-20 13:09:08 +02:00
|
|
|
[switch]$DisableTelemetry,
|
|
|
|
|
[switch]$DisableBingSearches, [switch]$DisableBing,
|
|
|
|
|
[switch]$DisableLockscrTips, [switch]$DisableLockscreenTips,
|
|
|
|
|
[switch]$DisableWindowsSuggestions, [switch]$DisableSuggestions,
|
|
|
|
|
[switch]$ShowHiddenFolders,
|
|
|
|
|
[switch]$ShowKnownFileExt,
|
|
|
|
|
[switch]$HideDupliDrive,
|
|
|
|
|
[switch]$TaskbarAlignLeft,
|
|
|
|
|
[switch]$HideSearchTb, [switch]$ShowSearchIconTb, [switch]$ShowSearchLabelTb, [switch]$ShowSearchBoxTb,
|
|
|
|
|
[switch]$HideTaskview,
|
|
|
|
|
[switch]$DisableCopilot,
|
2024-06-05 09:17:24 +02:00
|
|
|
[switch]$DisableRecall,
|
2024-05-20 13:09:08 +02:00
|
|
|
[switch]$DisableWidgets,
|
|
|
|
|
[switch]$HideWidgets,
|
|
|
|
|
[switch]$DisableChat,
|
|
|
|
|
[switch]$HideChat,
|
|
|
|
|
[switch]$ClearStart,
|
2024-06-28 16:54:35 +02:00
|
|
|
[switch]$ClearStartAllUsers,
|
2024-05-20 13:09:08 +02:00
|
|
|
[switch]$RevertContextMenu,
|
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,
|
2024-05-20 13:09:08 +02:00
|
|
|
[switch]$DisableOnedrive, [switch]$HideOnedrive,
|
|
|
|
|
[switch]$Disable3dObjects, [switch]$Hide3dObjects,
|
|
|
|
|
[switch]$DisableMusic, [switch]$HideMusic,
|
|
|
|
|
[switch]$DisableIncludeInLibrary, [switch]$HideIncludeInLibrary,
|
|
|
|
|
[switch]$DisableGiveAccessTo, [switch]$HideGiveAccessTo,
|
|
|
|
|
[switch]$DisableShare, [switch]$HideShare
|
|
|
|
|
)
|
|
|
|
|
|
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") {
|
|
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
2024-06-15 01:01:47 +02:00
|
|
|
# Download latest version of Win11Debloat from github as zip archive
|
2024-06-16 00:09:00 +02:00
|
|
|
Invoke-WebRequest http://github.com/raphire/win11debloat/archive/master.zip -OutFile "$env:TEMP/win11debloat-temp.zip"
|
|
|
|
|
|
2024-09-29 12:32:07 +02:00
|
|
|
# Remove old script folder if it exists, except for CustomAppsList and SavedSettings files
|
|
|
|
|
if (Test-Path "$env:TEMP/Win11Debloat/Win11Debloat-master") {
|
2024-06-16 00:09:00 +02:00
|
|
|
Write-Output ""
|
|
|
|
|
Write-Output "> Cleaning up old Win11Debloat folder..."
|
2024-09-29 12:32:07 +02:00
|
|
|
Get-ChildItem -Path "$env:TEMP/Win11Debloat/Win11Debloat-master" -Exclude CustomAppsList,SavedSettings | Remove-Item -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
|
2024-06-16 00:09:00 +02:00
|
|
|
Expand-Archive "$env:TEMP/win11debloat-temp.zip" "$env:TEMP/Win11Debloat"
|
2024-05-20 13:09:08 +02:00
|
|
|
|
2024-06-15 01:01:47 +02:00
|
|
|
# Remove archive
|
2024-06-16 00:09:00 +02:00
|
|
|
Remove-Item "$env:TEMP/win11debloat-temp.zip"
|
2024-05-20 13:09:08 +02:00
|
|
|
|
2024-06-15 01:01:47 +02:00
|
|
|
# Make list of arguments to pass on to the script
|
2024-06-16 00:09:00 +02:00
|
|
|
$arguments = $($PSBoundParameters.GetEnumerator() | ForEach-Object {"-$($_.Key)"})
|
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
|
|
|
|
2024-06-15 01:01:47 +02:00
|
|
|
# Run Win11Debloat script with the provided arguments
|
2024-06-18 23:34:27 +02:00
|
|
|
$debloatProcess = Start-Process powershell.exe -PassThru -ArgumentList "-executionpolicy bypass -File $env:TEMP\Win11Debloat\Win11Debloat-master\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
|
|
|
|
2024-09-29 12:32:07 +02:00
|
|
|
# Remove all remaining script files, except for CustomAppsList and SavedSettings files
|
|
|
|
|
if (Test-Path "$env:TEMP/Win11Debloat/Win11Debloat-master") {
|
|
|
|
|
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
|
|
|
|
|
Get-ChildItem -Path "$env:TEMP/Win11Debloat/Win11Debloat-master" -Exclude CustomAppsList,SavedSettings | Remove-Item -Recurse -Force
|
|
|
|
|
}
|
2024-06-16 00:09:00 +02:00
|
|
|
|
|
|
|
|
Write-Output ""
|