2022-10-04 21:10:29 +02:00
# Requires -RunAsAdministrator
2020-11-07 02:57:38 +01:00
[ CmdletBinding ( SupportsShouldProcess ) ]
2024-01-31 22:19:50 +01:00
param (
2024-03-11 23:38:19 +01:00
[ switch ] $Silent ,
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-27 16:44:05 +01:00
[ switch ] $NoRestartExplorer ,
2025-05-03 17:55:31 +02:00
[ switch ] $CreateRestorePoint ,
2025-04-19 15:16:47 +02:00
[ switch ] $RunAppsListGenerator , [ switch ] $RunAppConfigurator ,
2025-09-13 23:36:38 +02:00
[ switch ] $RunDefaults ,
[ switch ] $RunDefaultsLite ,
2025-01-09 21:33:28 +01:00
[ switch ] $RunSavedSettings ,
2025-12-26 20:36:51 +01:00
[ string ] $Apps ,
[ switch ] $RemoveApps ,
2024-03-11 23:38:19 +01:00
[ switch ] $RemoveAppsCustom ,
[ switch ] $RemoveGamingApps ,
[ switch ] $RemoveCommApps ,
2025-05-04 12:27:19 -04:00
[ switch ] $RemoveHPApps ,
2024-03-11 23:38:19 +01: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 ,
2024-03-11 23:38:19 +01:00
[ switch ] $DisableTelemetry ,
2025-05-01 22:32:41 +01:00
[ switch ] $DisableFastStartup ,
2025-08-19 23:24:28 +05:30
[ switch ] $DisableModernStandbyNetworking ,
2025-12-26 20:36:51 +01:00
[ switch ] $DisableBing , [ switch ] $DisableBingSearches ,
2024-12-26 19:06:49 +01:00
[ switch ] $DisableDesktopSpotlight ,
2025-12-26 20:36:51 +01:00
[ switch ] $DisableLockscreenTips , [ switch ] $DisableLockscrTips ,
[ switch ] $DisableSuggestions , [ switch ] $DisableWindowsSuggestions ,
2025-08-16 01:36:00 +02:00
[ switch ] $DisableEdgeAds ,
2025-05-20 21:55:38 +02:00
[ switch ] $DisableSettings365Ads ,
2025-05-20 21:56:04 +02:00
[ switch ] $DisableSettingsHome ,
2024-03-11 23:38:19 +01:00
[ switch ] $ShowHiddenFolders ,
[ switch ] $ShowKnownFileExt ,
[ switch ] $HideDupliDrive ,
2025-06-12 21:50:57 +02:00
[ switch ] $EnableDarkMode ,
[ switch ] $DisableTransparency ,
[ switch ] $DisableAnimations ,
2024-03-11 23:38:19 +01: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-03-11 23:38:19 +01:00
[ switch ] $HideSearchTb , [ switch ] $ShowSearchIconTb , [ switch ] $ShowSearchLabelTb , [ switch ] $ShowSearchBoxTb ,
[ switch ] $HideTaskview ,
2025-02-03 21:27:46 +01:00
[ switch ] $DisableStartRecommended ,
2025-06-11 22:04:17 +02:00
[ switch ] $DisableStartPhoneLink ,
2024-03-11 23:38:19 +01:00
[ switch ] $DisableCopilot ,
2024-06-05 09:17:24 +02:00
[ switch ] $DisableRecall ,
2025-09-17 23:33:52 +02:00
[ switch ] $DisableClickToDo ,
2025-08-01 21:21:38 +02:00
[ switch ] $DisablePaintAI ,
[ switch ] $DisableNotepadAI ,
2025-08-16 01:36:00 +02:00
[ switch ] $DisableEdgeAI ,
2025-02-13 21:08:47 +01:00
[ switch ] $DisableWidgets , [ switch ] $HideWidgets ,
2025-12-26 20:36:51 +01:00
[ switch ] $HideChat , [ switch ] $DisableChat ,
2025-04-16 12:31:18 +02:00
[ switch ] $EnableEndTask ,
2025-07-30 15:30:51 -04:00
[ switch ] $EnableLastActiveClick ,
2024-03-11 23:38:19 +01:00
[ switch ] $ClearStart ,
2025-05-19 00:01:49 +02:00
[ string ] $ReplaceStart ,
2024-06-27 23:08:43 +02:00
[ switch ] $ClearStartAllUsers ,
2025-05-19 00:01:49 +02:00
[ string ] $ReplaceStartAllUsers ,
2024-03-11 23:38:19 +01:00
[ switch ] $RevertContextMenu ,
2025-02-13 21:08:47 +01:00
[ switch ] $DisableMouseAcceleration ,
2025-04-16 12:56:37 +02:00
[ switch ] $DisableStickyKeys ,
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-27 16:44:05 +01:00
[ switch ] $AddFoldersToThisPC ,
2025-12-26 20:36:51 +01:00
[ switch ] $HideOnedrive , [ switch ] $DisableOnedrive ,
[ switch ] $Hide3dObjects , [ switch ] $Disable3dObjects ,
[ switch ] $HideMusic , [ switch ] $DisableMusic ,
[ switch ] $HideIncludeInLibrary , [ switch ] $DisableIncludeInLibrary ,
[ switch ] $HideGiveAccessTo , [ switch ] $DisableGiveAccessTo ,
[ switch ] $HideShare , [ switch ] $DisableShare
2020-11-07 02:57:38 +01:00
)
2023-08-03 22:24:27 +02:00
2025-12-15 23:22:29 +01:00
2025-12-26 20:36:51 +01:00
# Define script-level variables & paths
$script:DefaultSettingsFilePath = " $PSScriptRoot /DefaultSettings.json "
$script:AppsListFilePath = " $PSScriptRoot /Appslist.txt "
$script:SavedSettingsFilePath = " $PSScriptRoot /LastUsedSettings.json "
$script:CustomAppsListFilePath = " $PSScriptRoot /CustomAppsList "
$script:DefaultLogPath = " $PSScriptRoot /Win11Debloat.log "
$script:RegfilesPath = " $PSScriptRoot /Regfiles "
$script:AssetsPath = " $PSScriptRoot /Assets "
$script:ControlParams = 'WhatIf' , 'Confirm' , 'Verbose' , 'Debug' , 'LogPath' , 'Silent' , 'Sysprep' , 'User' , 'NoRestartExplorer' , 'RunDefaults' , 'RunDefaultsLite' , 'RunSavedSettings' , 'RunAppsListGenerator'
$script:Features = @ {
" RemoveApps " = " Remove the apps specified in the 'Apps' parameter "
" Apps " = " The selection of apps to remove, specified as a comma separated list. Use 'Default' (or omit) to use the default apps list "
" RemoveAppsCustom " = " Remove custom selection of apps "
" RemoveCommApps " = " Remove the Mail, Calendar, and People apps "
" RemoveW11Outlook " = " Remove the new Outlook for Windows app "
" RemoveGamingApps " = " Remove the Xbox App and Xbox Gamebar "
" RemoveHPApps " = " Remove HP OEM applications "
" CreateRestorePoint " = " Create a system restore point "
" DisableTelemetry " = " Disable telemetry, diagnostic data, activity history, app-launch tracking & targeted ads "
" DisableSuggestions " = " Disable tips, tricks, suggestions and ads in start, settings, notifications and File Explorer "
" DisableEdgeAds " = " Disable ads, suggestions and the MSN news feed in Microsoft Edge "
" DisableLockscreenTips " = " Disable tips & tricks on the lockscreen "
" DisableBing " = " Disable & remove Bing web search, Bing AI and Cortana from Windows search "
" DisableCopilot " = " Disable & remove Microsoft Copilot "
" DisableRecall " = " Disable Windows Recall (Windows 11 only) "
" DisableClickToDo " = " Disable Click to Do, AI text & image analysis (Windows 11 only) "
" DisableWidgets " = " Disable widgets on the taskbar & lockscreen "
" HideChat " = " Hide the chat (meet now) icon from the taskbar (Windows 10 only) "
" ShowKnownFileExt " = " Show file extensions for known file types "
" DisableFastStartup " = " Disable Fast Start-up "
" Hide3dObjects " = " Hide the 3D objects folder under 'This pc' in File Explorer (Windows 10 only) "
" DisableModernStandbyNetworking " = " Disable network connectivity during Modern Standby (If supported) "
" DisableDVR " = " Disable Xbox game/screen recording "
" DisableGameBarIntegration " = " Disable Game Bar integration "
" ClearStart " = " Remove all pinned apps from the start menu for this user only "
" ClearStartAllUsers " = " Remove all pinned apps from the start menu for all existing and new users "
" ReplaceStart " = " Replace the start menu layout for this user only with the provided template file "
" ReplaceStartAllUsers " = " Replace the start menu layout for all existing and new users with the provided template file "
" DisableStartRecommended " = " Disable the recommended section in the start menu (Windows 11 only) "
" DisableStartPhoneLink " = " Disable the Phone Link mobile devices integration in the start menu "
" DisableSettings365Ads " = " Disable Microsoft 365 ads in Settings Home (Windows 11 only) "
" DisableSettingsHome " = " Completely hide the Settings 'Home' page (Windows 11 only) "
" DisableEdgeAI " = " Disable AI features in Microsoft Edge (Windows 11 only) "
" DisablePaintAI " = " Disable AI features in Paint (Windows 11 only) "
" DisableNotepadAI " = " Disable AI features in Notepad (Windows 11 only) "
" EnableDarkMode " = " Enable dark mode for system and apps "
" RevertContextMenu " = " Restore the old Windows 10 style context menu (Windows 11 only) "
" DisableMouseAcceleration " = " Turn off Enhance Pointer Precision (mouse acceleration) "
" DisableStickyKeys " = " Disable the Sticky Keys keyboard shortcut (Windows 11 only) "
" DisableDesktopSpotlight " = " Disable the Windows Spotlight desktop background option "
" TaskbarAlignLeft " = " Align taskbar icons to the left (Windows 11 only) "
" CombineTaskbarAlways " = " Always combine taskbar buttons and hide labels for the main display (Windows 11 only) "
" CombineMMTaskbarAlways " = " Always combine taskbar buttons and hide labels for secondary displays (Windows 11 only) "
" CombineTaskbarWhenFull " = " Combine taskbar buttons and hide labels when taskbar is full for the main display (Windows 11 only) "
" CombineMMTaskbarWhenFull " = " Combine taskbar buttons and hide labels when taskbar is full for secondary displays (Windows 11 only) "
" CombineTaskbarNever " = " Never combine taskbar buttons and show labels for the main display (Windows 11 only) "
" CombineMMTaskbarNever " = " Never combine taskbar buttons and show labels for secondary displays (Windows 11 only) "
" MMTaskbarModeAll " = " Show app icons on all taskbars (Windows 11 only) "
" MMTaskbarModeMainActive " = " Show app icons on main taskbar and on taskbar where the windows is open (Windows 11 only) "
" MMTaskbarModeActive " = " Show app icons only on taskbar where the window is open (Windows 11 only) "
" HideSearchTb " = " Hide search icon from the taskbar (Windows 11 only) "
" ShowSearchIconTb " = " Show search icon on the taskbar (Windows 11 only) "
" ShowSearchLabelTb " = " Show search icon with label on the taskbar (Windows 11 only) "
" ShowSearchBoxTb " = " Show search box on the taskbar (Windows 11 only) "
" HideTaskview " = " Hide the taskview button from the taskbar (Windows 11 only) "
" EnableEndTask " = " Enable the 'End Task' option in the taskbar right click menu (Windows 11 only) "
" EnableLastActiveClick " = " Enable the 'Last Active Click' behavior in the taskbar app area "
" ShowHiddenFolders " = " Show hidden files, folders and drives "
" ExplorerToHome " = " Change the default location that File Explorer opens to 'Home' "
" ExplorerToThisPC " = " Change the default location that File Explorer opens to 'This PC' "
" ExplorerToDownloads " = " Change the default location that File Explorer opens to 'Downloads' "
" ExplorerToOneDrive " = " Change the default location that File Explorer opens to 'OneDrive' "
2025-12-27 16:44:05 +01:00
" AddFoldersToThisPC " = " Add all common folders (Desktop, Downloads, etc.) back to 'This PC' in File Explorer "
2025-12-26 20:36:51 +01:00
" HideHome " = " Hide the Home section from the File Explorer sidepanel (Windows 11 only) "
" HideGallery " = " Hide the Gallery section from the File Explorer sidepanel (Windows 11 only) "
" HideDupliDrive " = " Hide duplicate removable drive entries from the File Explorer sidepanel "
" DisableTransparency " = " Disable transparency effects "
" DisableAnimations " = " Disable animations and visual effects "
" ForceRemoveEdge " = " Forcefully uninstall Microsoft Edge. NOT RECOMMENDED! "
" HideIncludeInLibrary " = " Hide the 'Include in library' option in the context menu (Windows 10 only) "
" HideGiveAccessTo " = " Hide the 'Give access to' option in the context menu (Windows 10 only) "
" HideShare " = " Hide the 'Share' option in the context menu (Windows 10 only) "
" HideOnedrive " = " Hide the OneDrive folder in the File Explorer sidepanel (Windows 10 only) "
" HideMusic " = " Hide the music folder under 'This pc' in File Explorer (Windows 10 only) "
}
# Check if current powershell environment is limited by security policies
2024-06-26 20:27:25 +02:00
if ( $ExecutionContext . SessionState . LanguageMode -ne " FullLanguage " ) {
2025-12-26 20:36:51 +01:00
Write-Error " Win11Debloat is unable to run on your system, powershell execution is restricted by security policies "
Write-Output " Press any key to exit... "
$null = [ System.Console ] :: ReadKey ( )
Exit
}
# Check if script does not see file dependencies
if ( -not ( ( Test-Path $script:DefaultSettingsFilePath ) -and ( Test-Path $script:AppsListFilePath ) -and ( Test-Path $script:RegfilesPath ) -and ( Test-Path $script:AssetsPath ) ) ) {
Write-Error " Win11Debloat is unable to find required files, please ensure all script files are present "
Write-Output " Press any key to exit... "
$null = [ System.Console ] :: ReadKey ( )
Exit
2024-06-26 20:27:25 +02:00
}
2025-05-10 13:02:48 +02:00
# Log script output to 'Win11Debloat.log' at the specified path
2025-05-25 20:25:06 +02:00
if ( $LogPath -and ( Test-Path $LogPath ) ) {
2025-05-10 13:02:48 +02:00
Start-Transcript -Path " $LogPath /Win11Debloat.log " -Append -IncludeInvocationHeader -Force | Out-Null
}
else {
2025-12-26 20:36:51 +01:00
Start-Transcript -Path $script:DefaultLogPath -Append -IncludeInvocationHeader -Force | Out-Null
2025-05-10 13:02:48 +02:00
}
2024-06-26 20:27:25 +02:00
2025-12-15 23:22:29 +01:00
##################################################################################################################
# #
# FUNCTION DEFINITIONS #
# #
##################################################################################################################
2024-03-04 00:10:24 +01:00
# Shows application selection form that allows the user to select what apps they want to remove or keep
function ShowAppSelectionForm {
[ reflection.assembly ] :: loadwithpartialname ( " System.Windows.Forms " ) | Out-Null
[ reflection.assembly ] :: loadwithpartialname ( " System.Drawing " ) | Out-Null
# Initialise form objects
$form = New-Object System . Windows . Forms . Form
$label = New-Object System . Windows . Forms . Label
$button1 = New-Object System . Windows . Forms . Button
$button2 = New-Object System . Windows . Forms . Button
2025-12-26 20:36:51 +01:00
$selectionBox = New-Object System . Windows . Forms . CheckedListBox
2024-03-04 12:56:12 +01:00
$loadingLabel = New-Object System . Windows . Forms . Label
$onlyInstalledCheckBox = New-Object System . Windows . Forms . CheckBox
2024-04-05 23:35:10 +02:00
$checkUncheckCheckBox = New-Object System . Windows . Forms . CheckBox
2024-03-04 12:56:12 +01:00
$initialFormWindowState = New-Object System . Windows . Forms . FormWindowState
2024-03-04 00:10:24 +01:00
2025-12-26 20:36:51 +01:00
$script:SelectionBoxIndex = -1
2024-04-05 23:35:10 +02:00
2024-03-04 00:10:24 +01:00
# saveButton eventHandler
2025-12-26 20:36:51 +01:00
$handler_saveButton_Click =
2024-03-04 00:10:24 +01:00
{
2024-09-17 15:06:18 +02:00
if ( $selectionBox . CheckedItems -contains " Microsoft.WindowsStore " -and -not $Silent ) {
$warningSelection = [ System.Windows.Forms.Messagebox ] :: Show ( 'Are you sure you wish to uninstall the Microsoft Store? This app cannot easily be reinstalled.' , 'Are you sure?' , 'YesNo' , 'Warning' )
2025-12-26 20:36:51 +01:00
2024-09-17 15:06:18 +02:00
if ( $warningSelection -eq 'No' ) {
return
}
}
2025-05-10 13:02:48 +02:00
$script:SelectedApps = $selectionBox . CheckedItems
2024-03-04 00:10:24 +01:00
2025-12-26 20:36:51 +01:00
# Close form without saving if no apps were selected
if ( $script:SelectedApps . Count -eq 0 ) {
$form . Close ( )
return
}
2024-03-04 00:10:24 +01:00
# Create file that stores selected apps if it doesn't exist
2025-12-26 20:36:51 +01:00
if ( -not ( Test-Path $script:CustomAppsListFilePath ) ) {
$null = New-Item $script:CustomAppsListFilePath
2025-12-15 23:22:29 +01:00
}
2024-03-04 00:10:24 +01:00
2025-12-26 20:36:51 +01:00
Set-Content -Path $script:CustomAppsListFilePath -Value $script:SelectedApps
2024-03-04 00:10:24 +01:00
2024-09-17 15:06:18 +02:00
$form . DialogResult = [ System.Windows.Forms.DialogResult ] :: OK
2024-03-04 00:10:24 +01:00
$form . Close ( )
}
# cancelButton eventHandler
2025-12-26 20:36:51 +01:00
$handler_cancelButton_Click =
2024-03-04 00:10:24 +01:00
{
$form . Close ( )
}
2025-12-26 20:36:51 +01:00
$selectionBox_SelectedIndexChanged =
2024-04-05 23:35:10 +02:00
{
2025-12-26 20:36:51 +01:00
$script:SelectionBoxIndex = $selectionBox . SelectedIndex
2024-04-05 23:35:10 +02:00
}
$selectionBox_MouseDown =
{
if ( $_ . Button -eq [ System.Windows.Forms.MouseButtons ] :: Left ) {
2024-08-17 00:08:09 +02:00
if ( [ System.Windows.Forms.Control ] :: ModifierKeys -eq [ System.Windows.Forms.Keys ] :: Shift ) {
2025-12-26 20:36:51 +01:00
if ( $script:SelectionBoxIndex -ne -1 ) {
$topIndex = $script:SelectionBoxIndex
2024-04-05 23:35:10 +02:00
if ( $selectionBox . SelectedIndex -gt $topIndex ) {
2025-05-16 18:26:06 +02:00
for ( ( $i = ( $topIndex ) ) ; $i -le $selectionBox . SelectedIndex ; $i + + ) {
2024-04-05 23:35:10 +02:00
$selectionBox . SetItemChecked ( $i , $selectionBox . GetItemChecked ( $topIndex ) )
}
}
elseif ( $topIndex -gt $selectionBox . SelectedIndex ) {
2025-05-16 18:26:06 +02:00
for ( ( $i = ( $selectionBox . SelectedIndex ) ) ; $i -le $topIndex ; $i + + ) {
2024-04-05 23:35:10 +02:00
$selectionBox . SetItemChecked ( $i , $selectionBox . GetItemChecked ( $topIndex ) )
}
}
}
}
2025-12-26 20:36:51 +01:00
elseif ( $script:SelectionBoxIndex -ne $selectionBox . SelectedIndex ) {
2024-04-05 23:35:10 +02:00
$selectionBox . SetItemChecked ( $selectionBox . SelectedIndex , -not $selectionBox . GetItemChecked ( $selectionBox . SelectedIndex ) )
}
}
}
$check_All =
{
2025-05-16 18:26:06 +02:00
for ( ( $i = 0 ) ; $i -lt $selectionBox . Items . Count ; $i + + ) {
2024-04-05 23:35:10 +02:00
$selectionBox . SetItemChecked ( $i , $checkUncheckCheckBox . Checked )
}
}
2024-03-04 12:56:12 +01:00
$load_Apps =
2024-03-04 00:10:24 +01:00
{
2024-03-04 12:56:12 +01:00
# Correct the initial state of the form to prevent the .Net maximized form issue
$form . WindowState = $initialFormWindowState
2024-04-05 23:35:10 +02:00
# Reset state to default before loading appslist again
2025-12-26 20:36:51 +01:00
$script:SelectionBoxIndex = -1
2024-04-05 23:35:10 +02:00
$checkUncheckCheckBox . Checked = $False
2024-03-04 12:56:12 +01:00
# Show loading indicator
$loadingLabel . Visible = $true
$form . Refresh ( )
# Clear selectionBox before adding any new items
$selectionBox . Items . Clear ( )
2024-03-29 16:56:29 +01:00
$listOfApps = " "
2025-12-26 20:36:51 +01:00
if ( $onlyInstalledCheckBox . Checked -and ( $script:WingetInstalled -eq $true ) ) {
2024-04-01 14:07:59 +02:00
# Attempt to get a list of installed apps via winget, times out after 10 seconds
$job = Start-Job { return winget list - -accept -source -agreements - -disable -interactivity }
$jobDone = $job | Wait-Job -TimeOut 10
if ( -not $jobDone ) {
# Show error that the script was unable to get list of apps from winget
2024-09-17 15:06:18 +02:00
[ System.Windows.MessageBox ] :: Show ( 'Unable to load list of installed apps via winget, some apps may not be displayed in the list.' , 'Error' , 'Ok' , 'Error' )
2024-04-01 14:07:59 +02:00
}
else {
# Add output of job (list of apps) to $listOfApps
$listOfApps = Receive-Job -Job $job
}
2024-03-29 16:56:29 +01:00
}
2024-03-04 12:56:12 +01:00
# Go through appslist and add items one by one to the selectionBox
2025-12-26 20:36:51 +01:00
Foreach ( $app in ( Get-Content -Path $script:AppsListFilePath | Where-Object { $_ -notmatch '^\s*$' -and $_ -notmatch '^# .*' -and $_ -notmatch '^# -* #' } ) ) {
2024-03-04 12:56:12 +01:00
$appChecked = $true
2024-08-19 21:27:53 +02:00
# Remove first # if it exists and set appChecked to false
2024-03-04 12:56:12 +01:00
if ( $app . StartsWith ( '#' ) ) {
$app = $app . TrimStart ( " # " )
$appChecked = $false
}
2024-08-19 21:27:53 +02:00
2024-03-04 12:56:12 +01:00
# Remove any comments from the Appname
if ( -not ( $app . IndexOf ( '#' ) -eq -1 ) ) {
$app = $app . Substring ( 0 , $app . IndexOf ( '#' ) )
}
2025-12-26 20:36:51 +01:00
2024-08-19 21:27:53 +02:00
# Remove leading and trailing spaces and `*` characters from Appname
$app = $app . Trim ( )
2024-03-04 12:56:12 +01:00
$appString = $app . Trim ( '*' )
# Make sure appString is not empty
if ( $appString . length -gt 0 ) {
2024-03-29 16:56:29 +01:00
if ( $onlyInstalledCheckBox . Checked ) {
# onlyInstalledCheckBox is checked, check if app is installed before adding it to selectionBox
2024-08-19 21:27:53 +02:00
if ( -not ( $listOfApps -like ( " * $appString * " ) ) -and -not ( Get-AppxPackage -Name $app ) ) {
2024-07-02 18:51:00 +02:00
# App is not installed, continue with next item
continue
2024-03-29 16:56:29 +01:00
}
2024-07-02 18:51:00 +02:00
if ( ( $appString -eq " Microsoft.Edge " ) -and -not ( $listOfApps -like " * Microsoft.Edge * " ) ) {
# App is not installed, continue with next item
2024-03-04 12:56:12 +01:00
continue
}
}
2025-12-26 20:36:51 +01:00
# Add the app to the selectionBox and set its checked status
2024-03-04 12:56:12 +01:00
$selectionBox . Items . Add ( $appString , $appChecked ) | Out-Null
}
}
2025-12-26 20:36:51 +01:00
2024-03-04 12:56:12 +01:00
# Hide loading indicator
2024-04-05 23:35:10 +02:00
$loadingLabel . Visible = $False
2024-03-04 12:56:12 +01:00
# Sort selectionBox alphabetically
2024-04-05 23:35:10 +02:00
$selectionBox . Sorted = $True
2024-03-04 00:10:24 +01:00
}
$form . Text = " Win11Debloat Application Selection "
$form . Name = " appSelectionForm "
$form . DataBindings . DefaultDataSourceUpdateMode = 0
2024-04-05 23:35:10 +02:00
$form . ClientSize = New-Object System . Drawing . Size ( 400 , 502 )
2024-03-04 12:56:12 +01:00
$form . FormBorderStyle = 'FixedDialog'
2024-04-05 23:35:10 +02:00
$form . MaximizeBox = $False
2024-03-04 00:10:24 +01:00
$button1 . TabIndex = 4
$button1 . Name = " saveButton "
$button1 . UseVisualStyleBackColor = $True
2024-03-29 16:56:29 +01:00
$button1 . Text = " Confirm "
2024-04-05 23:35:10 +02:00
$button1 . Location = New-Object System . Drawing . Point ( 27 , 472 )
2024-03-04 00:10:24 +01:00
$button1 . Size = New-Object System . Drawing . Size ( 75 , 23 )
$button1 . DataBindings . DefaultDataSourceUpdateMode = 0
$button1 . add_Click ( $handler_saveButton_Click )
$form . Controls . Add ( $button1 )
$button2 . TabIndex = 5
$button2 . Name = " cancelButton "
$button2 . DialogResult = [ System.Windows.Forms.DialogResult ] :: Cancel
$button2 . UseVisualStyleBackColor = $True
$button2 . Text = " Cancel "
2024-04-05 23:35:10 +02:00
$button2 . Location = New-Object System . Drawing . Point ( 129 , 472 )
2024-03-04 00:10:24 +01:00
$button2 . Size = New-Object System . Drawing . Size ( 75 , 23 )
$button2 . DataBindings . DefaultDataSourceUpdateMode = 0
$button2 . add_Click ( $handler_cancelButton_Click )
$form . Controls . Add ( $button2 )
2024-03-04 12:56:12 +01:00
$label . Location = New-Object System . Drawing . Point ( 13 , 5 )
2024-04-05 23:35:10 +02:00
$label . Size = New-Object System . Drawing . Size ( 400 , 14 )
$Label . Font = 'Microsoft Sans Serif,8'
2024-03-04 12:56:12 +01:00
$label . Text = 'Check apps that you wish to remove, uncheck apps that you wish to keep'
2024-03-04 00:10:24 +01:00
$form . Controls . Add ( $label )
2024-04-05 23:35:10 +02:00
$loadingLabel . Location = New-Object System . Drawing . Point ( 16 , 46 )
2024-03-29 16:56:29 +01:00
$loadingLabel . Size = New-Object System . Drawing . Size ( 300 , 418 )
$loadingLabel . Text = 'Loading apps...'
2024-03-04 12:56:12 +01:00
$loadingLabel . BackColor = " White "
$loadingLabel . Visible = $false
$form . Controls . Add ( $loadingLabel )
$onlyInstalledCheckBox . TabIndex = 6
2024-04-05 23:35:10 +02:00
$onlyInstalledCheckBox . Location = New-Object System . Drawing . Point ( 230 , 474 )
2024-03-04 12:56:12 +01:00
$onlyInstalledCheckBox . Size = New-Object System . Drawing . Size ( 150 , 20 )
$onlyInstalledCheckBox . Text = 'Only show installed apps'
$onlyInstalledCheckBox . add_CheckedChanged ( $load_Apps )
$form . Controls . Add ( $onlyInstalledCheckBox )
2024-04-05 23:35:10 +02:00
$checkUncheckCheckBox . TabIndex = 7
$checkUncheckCheckBox . Location = New-Object System . Drawing . Point ( 16 , 22 )
$checkUncheckCheckBox . Size = New-Object System . Drawing . Size ( 150 , 20 )
$checkUncheckCheckBox . Text = 'Check/Uncheck all'
$checkUncheckCheckBox . add_CheckedChanged ( $check_All )
$form . Controls . Add ( $checkUncheckCheckBox )
2024-03-04 00:10:24 +01:00
$selectionBox . FormattingEnabled = $True
$selectionBox . DataBindings . DefaultDataSourceUpdateMode = 0
$selectionBox . Name = " selectionBox "
2024-04-05 23:35:10 +02:00
$selectionBox . Location = New-Object System . Drawing . Point ( 13 , 43 )
2024-03-04 00:10:24 +01:00
$selectionBox . Size = New-Object System . Drawing . Size ( 374 , 424 )
$selectionBox . TabIndex = 3
2024-04-05 23:35:10 +02:00
$selectionBox . add_SelectedIndexChanged ( $selectionBox_SelectedIndexChanged )
$selectionBox . add_Click ( $selectionBox_MouseDown )
2024-03-04 00:10:24 +01:00
$form . Controls . Add ( $selectionBox )
# Save the initial state of the form
2024-03-04 12:56:12 +01:00
$initialFormWindowState = $form . WindowState
2024-03-04 00:10:24 +01:00
2024-03-04 12:56:12 +01:00
# Load apps into selectionBox
$form . add_Load ( $load_Apps )
2024-03-04 00:10:24 +01:00
# Focus selectionBox when form opens
$form . Add_Shown ( { $form . Activate ( ) ; $selectionBox . Focus ( ) } )
# Show the Form
return $form . ShowDialog ( )
}
2025-12-26 20:36:51 +01:00
# Returns a validated list of apps based on the provided appsList and the supported apps from Appslist.txt
function ValidateAppslist {
param (
$appsList
)
$supportedAppsList = @ ( )
$validatedAppsList = @ ( )
# Generate a list of supported apps from AppsList.txt
Foreach ( $app in ( Get-Content -Path $script:AppsListFilePath | Where-Object { $_ -notmatch '^\s*$' -and $_ -notmatch '^# .*' -and $_ -notmatch '^# -* #' } ) ) {
$app = $app . TrimStart ( " # " )
if ( -not ( $app . IndexOf ( '#' ) -eq -1 ) ) {
$app = $app . Substring ( 0 , $app . IndexOf ( '#' ) )
}
$app = $app . Trim ( )
$appString = $app . Trim ( '*' )
$supportedAppsList + = $appString
}
# Validate provided appsList against supportedAppsList
Foreach ( $app in $appsList ) {
$app = $app . Trim ( )
$appString = $app . Trim ( '*' )
if ( $supportedAppsList -notcontains $appString ) {
Write-Host " Removal of app ' $appString ' is not supported and will be skipped " -ForegroundColor Yellow
continue
}
$validatedAppsList + = $appString
}
return $validatedAppsList
}
2024-08-02 13:31:20 +02:00
# Returns list of apps from the specified file, it trims the app names and removes any comments
function ReadAppslistFromFile {
2024-01-31 22:19:50 +01:00
param (
2024-03-29 16:56:29 +01:00
$appsFilePath
2023-08-03 01:18:02 +02:00
)
2024-03-29 16:56:29 +01:00
$appsList = @ ( )
2025-12-26 20:36:51 +01:00
if ( -not ( Test-Path $appsFilePath ) ) {
return $appsList
}
2024-03-29 16:56:29 +01:00
Foreach ( $app in ( Get-Content -Path $appsFilePath | Where-Object { $_ -notmatch '^#.*' -and $_ -notmatch '^\s*$' } ) ) {
2023-09-29 02:39:56 +02:00
if ( -not ( $app . IndexOf ( '#' ) -eq -1 ) ) {
2023-08-02 21:58:09 +02:00
$app = $app . Substring ( 0 , $app . IndexOf ( '#' ) )
}
2024-08-02 13:31:20 +02:00
$app = $app . Trim ( )
2023-08-03 22:40:19 +02:00
$appString = $app . Trim ( '*' )
2024-03-29 16:56:29 +01:00
$appsList + = $appString
2020-10-27 23:26:39 +01:00
}
2023-10-15 19:48:27 +02:00
2024-08-02 13:31:20 +02:00
return $appsList
2020-10-27 23:26:39 +01:00
}
2023-08-03 22:24:27 +02:00
2023-11-19 23:40:35 +01:00
# Removes apps specified during function call from all user accounts and from the OS image.
2024-03-29 16:56:29 +01:00
function RemoveApps {
2024-01-31 22:19:50 +01:00
param (
2023-11-19 23:40:35 +01:00
$appslist
)
2025-12-26 20:36:51 +01:00
Foreach ( $app in $appsList ) {
2024-03-04 12:56:12 +01:00
Write-Output " Attempting to remove $app ... "
2025-12-15 23:22:29 +01:00
# Use winget only to remove OneDrive and Edge
2024-03-29 16:56:29 +01:00
if ( ( $app -eq " Microsoft.OneDrive " ) -or ( $app -eq " Microsoft.Edge " ) ) {
2025-12-26 20:36:51 +01:00
if ( $script:WingetInstalled -eq $false ) {
Write-Host " WinGet is either not installed or is outdated, $app could not be removed " -ForegroundColor Red
2025-12-15 23:22:29 +01:00
continue
}
$appName = $app -replace '\.' , '_'
# Uninstall app via winget, or create a scheduled task to uninstall it later
if ( $script:Params . ContainsKey ( " User " ) ) {
RegImport " Adding scheduled task to uninstall $app for user $( GetUserName ) ... " " Uninstall_ $( $appName ) .reg "
}
elseif ( $script:Params . ContainsKey ( " Sysprep " ) ) {
RegImport " Adding scheduled task to uninstall $app after new users log in... " " Uninstall_ $( $appName ) .reg "
2024-03-29 16:56:29 +01:00
}
else {
2025-12-26 20:36:51 +01:00
# Uninstall app via winget, with any progress indicators removed from the output
StripProgress -ScriptBlock { winget uninstall - -accept -source -agreements - -disable -interactivity - -id $app } | Tee-Object -Variable wingetOutput
2024-07-02 18:51:00 +02:00
2025-12-26 20:36:51 +01:00
If ( ( $app -eq " Microsoft.Edge " ) -and ( Select-String -InputObject $wingetOutput -Pattern " Uninstall failed with exit code " ) ) {
Write-Host " Unable to uninstall Microsoft Edge via Winget " -ForegroundColor Red
2024-07-02 18:51:00 +02:00
Write-Output " "
2025-12-26 20:36:51 +01:00
if ( $ ( Read-Host -Prompt " Would you like to forcefully uninstall Microsoft Edge? NOT RECOMMENDED! (y/n) " ) -eq 'y' ) {
Write-Output " "
ForceRemoveEdge
}
2024-07-02 18:51:00 +02:00
}
2024-03-29 16:56:29 +01:00
}
2025-12-15 23:22:29 +01:00
continue
2024-03-29 16:56:29 +01:00
}
2023-11-19 23:40:35 +01:00
2025-12-15 23:22:29 +01:00
# Use Remove-AppxPackage to remove all other apps
$app = '*' + $app + '*'
2024-11-01 18:01:40 +01:00
2025-12-15 23:22:29 +01:00
# Remove installed app for all existing users
try {
Get-AppxPackage -Name $app -AllUsers | Remove-AppxPackage -AllUsers -ErrorAction Continue
2023-11-19 23:40:35 +01:00
2025-12-15 23:22:29 +01:00
if ( $DebugPreference -ne " SilentlyContinue " ) {
Write-Host " Removed $app for all users " -ForegroundColor DarkGray
2024-10-02 00:42:22 +02:00
}
2025-12-15 23:22:29 +01:00
}
catch {
if ( $DebugPreference -ne " SilentlyContinue " ) {
Write-Host " Unable to remove $app for all users " -ForegroundColor Yellow
2024-10-02 00:42:22 +02:00
Write-Host $psitem . Exception . StackTrace -ForegroundColor Gray
}
2024-03-29 16:56:29 +01:00
}
2025-12-15 23:22:29 +01:00
# Remove provisioned app from OS image, so the app won't be installed for any new users
try {
Get-AppxProvisionedPackage -Online | Where-Object { $_ . PackageName -like $app } | ForEach-Object { Remove-ProvisionedAppxPackage -Online -AllUsers -PackageName $_ . PackageName }
}
catch {
Write-Host " Unable to remove $app from windows image " -ForegroundColor Yellow
Write-Host $psitem . Exception . StackTrace -ForegroundColor Gray
}
2023-11-19 23:40:35 +01:00
}
2025-12-26 20:36:51 +01:00
2024-08-02 13:31:20 +02:00
Write-Output " "
2023-11-19 23:40:35 +01:00
}
2025-12-26 20:36:51 +01:00
# Forcefully removes Microsoft Edge using its uninstaller
# Credit: Based on work from loadstring1 & ave9858
2024-07-02 18:51:00 +02:00
function ForceRemoveEdge {
Write-Output " > Forcefully uninstalling Microsoft Edge... "
$regView = [ Microsoft.Win32.RegistryView ] :: Registry32
$hklm = [ Microsoft.Win32.RegistryKey ] :: OpenBaseKey ( [ Microsoft.Win32.RegistryHive ] :: LocalMachine , $regView )
$hklm . CreateSubKey ( 'SOFTWARE\Microsoft\EdgeUpdateDev' ) . SetValue ( 'AllowUninstall' , '' )
2025-09-12 00:08:15 +02:00
# Create stub (Creating this somehow allows uninstalling Edge)
2024-07-02 18:51:00 +02:00
$edgeStub = " $env:SystemRoot \SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe "
New-Item $edgeStub -ItemType Directory | Out-Null
New-Item " $edgeStub \MicrosoftEdge.exe " | Out-Null
# Remove edge
$uninstallRegKey = $hklm . OpenSubKey ( 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Edge' )
2024-08-17 00:08:09 +02:00
if ( $null -ne $uninstallRegKey ) {
2024-07-02 18:51:00 +02:00
Write-Output " Running uninstaller... "
$uninstallString = $uninstallRegKey . GetValue ( 'UninstallString' ) + ' --force-uninstall'
Start-Process cmd . exe " /c $uninstallString " -WindowStyle Hidden -Wait
Write-Output " Removing leftover files... "
$edgePaths = @ (
" $env:ProgramData \Microsoft\Windows\Start Menu\Programs\Microsoft Edge.lnk " ,
" $env:APPDATA \Microsoft\Internet Explorer\Quick Launch\Microsoft Edge.lnk " ,
" $env:APPDATA \Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Microsoft Edge.lnk " ,
2024-08-31 22:13:59 +02:00
" $env:APPDATA \Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Tombstones\Microsoft Edge.lnk " ,
2024-07-02 18:51:00 +02:00
" $env:PUBLIC \Desktop\Microsoft Edge.lnk " ,
" $env:USERPROFILE \Desktop\Microsoft Edge.lnk " ,
" $edgeStub "
)
2025-05-16 18:26:06 +02:00
foreach ( $path in $edgePaths ) {
2024-07-02 18:51:00 +02:00
if ( Test-Path -Path $path ) {
Remove-Item -Path $path -Force -Recurse -ErrorAction SilentlyContinue
Write-Host " Removed $path " -ForegroundColor DarkGray
}
}
Write-Output " Cleaning up registry... "
2025-09-12 00:08:15 +02:00
# Remove MS Edge from autostart
2024-07-02 18:51:00 +02:00
reg delete " HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run " / v " MicrosoftEdgeAutoLaunch_A9F6DCE4ABADF4F51CF45CD7129E3C6C " / f * > $null
reg delete " HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run " / v " Microsoft Edge Update " / f * > $null
reg delete " HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run " / v " MicrosoftEdgeAutoLaunch_A9F6DCE4ABADF4F51CF45CD7129E3C6C " / f * > $null
reg delete " HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run " / v " Microsoft Edge Update " / f * > $null
Write-Output " Microsoft Edge was uninstalled "
}
else {
Write-Output " "
Write-Host " Error: Unable to forcefully uninstall Microsoft Edge, uninstaller could not be found " -ForegroundColor Red
}
2025-12-26 20:36:51 +01:00
2024-07-02 18:51:00 +02:00
Write-Output " "
}
# Execute provided command and strips progress spinners/bars from console output
2025-12-26 20:36:51 +01:00
function StripProgress {
2024-07-02 18:51:00 +02:00
param (
[ ScriptBlock ] $ScriptBlock
)
# Regex pattern to match spinner characters and progress bar patterns
$progressPattern = 'Γû[Æê]|^\s+[-\\|/]\s+$'
# Corrected regex pattern for size formatting, ensuring proper capture groups are utilized
$sizePattern = '(\d+(\.\d{1,2})?)\s+(B|KB|MB|GB|TB|PB) /\s+(\d+(\.\d{1,2})?)\s+(B|KB|MB|GB|TB|PB)'
& $ScriptBlock 2 > & 1 | ForEach-Object {
if ( $_ -is [ System.Management.Automation.ErrorRecord ] ) {
2025-12-26 20:36:51 +01:00
" Error: $( $_ . Exception . Message ) "
2025-12-15 23:22:29 +01:00
}
else {
2024-07-02 18:51:00 +02:00
$line = $_ -replace $progressPattern , '' -replace $sizePattern , ''
if ( -not ( [ string ] :: IsNullOrWhiteSpace ( $line ) ) -and -not ( $line . StartsWith ( ' ' ) ) ) {
$line
}
}
}
}
2025-08-22 17:50:47 +02:00
# Check if this machine supports S0 Modern Standby power state. Returns true if S0 Modern Standby is supported, false otherwise.
function CheckModernStandbySupport {
$count = 0
try {
switch -Regex ( powercfg / a ) {
':' {
$count + = 1
}
'(.*S0.{1,}\))' {
if ( $count -eq 1 ) {
return $true
}
}
}
}
catch {
Write-Host " Error: Unable to check for S0 Modern Standby support, powercfg command failed " -ForegroundColor Red
Write-Host " "
Write-Host " Press any key to continue... "
$null = [ System.Console ] :: ReadKey ( )
return $true
}
return $false
}
2025-09-07 15:04:29 +02:00
# Returns the directory path of the specified user, exits script if user path can't be found
function GetUserDirectory {
param (
$userName ,
2025-09-08 19:54:13 +02:00
$fileName = " " ,
$exitIfPathNotFound = $true
2025-09-07 15:04:29 +02:00
)
2025-09-28 20:40:24 +02:00
try {
$userDirectoryExists = Test-Path " $env:SystemDrive \Users\ $userName "
$userPath = " $env:SystemDrive \Users\ $userName \ $fileName "
2025-12-26 20:36:51 +01:00
2025-09-28 20:40:24 +02:00
if ( ( Test-Path $userPath ) -or ( $userDirectoryExists -and ( -not $exitIfPathNotFound ) ) ) {
return $userPath
}
2025-12-26 20:36:51 +01:00
2025-09-28 20:40:24 +02:00
$userDirectoryExists = Test-Path ( $env:USERPROFILE -Replace ( '\\' + $env:USERNAME + '$' ) , " \ $userName " )
$userPath = $env:USERPROFILE -Replace ( '\\' + $env:USERNAME + '$' ) , " \ $userName \ $fileName "
2025-12-26 20:36:51 +01:00
2025-09-28 20:40:24 +02:00
if ( ( Test-Path $userPath ) -or ( $userDirectoryExists -and ( -not $exitIfPathNotFound ) ) ) {
return $userPath
}
2025-12-15 23:22:29 +01:00
}
catch {
2025-12-26 20:36:51 +01:00
Write-Error " Something went wrong when trying to find the user directory path for user $userName . Please ensure the user exists on this system "
2025-09-28 20:40:24 +02:00
AwaitKeyToExit
2025-09-07 15:04:29 +02:00
}
2025-12-26 20:36:51 +01:00
Write-Error " Unable to find user directory path for user $userName "
2025-09-08 19:54:13 +02:00
AwaitKeyToExit
2025-09-07 15:04:29 +02:00
}
2022-04-09 18:52:16 +02:00
# Import & execute regfile
2023-05-15 16:38:11 -06:00
function RegImport {
2024-01-31 22:19:50 +01:00
param (
2023-12-15 13:22:35 +01:00
$message ,
$path
2020-11-07 02:57:38 +01:00
)
2020-11-04 01:48:42 +01:00
2023-12-15 13:22:35 +01:00
Write-Output $message
2024-06-27 23:08:43 +02:00
2025-05-10 13:02:48 +02:00
if ( $script:Params . ContainsKey ( " Sysprep " ) ) {
2025-09-07 15:04:29 +02:00
$defaultUserPath = GetUserDirectory -userName " Default " -fileName " NTUSER.DAT "
2025-12-26 20:36:51 +01:00
2024-08-31 22:13:59 +02:00
reg load " HKU\Default " $defaultUserPath | Out-Null
2025-12-26 20:36:51 +01:00
reg import " $script:RegfilesPath \Sysprep\ $path "
2025-03-05 23:39:29 +01:00
reg unload " HKU\Default " | Out-Null
}
2025-05-10 13:02:48 +02:00
elseif ( $script:Params . ContainsKey ( " User " ) ) {
2025-09-07 15:04:29 +02:00
$userPath = GetUserDirectory -userName $script:Params . Item ( " User " ) -fileName " NTUSER.DAT "
2025-12-26 20:36:51 +01:00
2025-03-05 23:39:29 +01:00
reg load " HKU\Default " $userPath | Out-Null
2025-12-26 20:36:51 +01:00
reg import " $script:RegfilesPath \Sysprep\ $path "
2024-06-27 23:08:43 +02:00
reg unload " HKU\Default " | Out-Null
2025-12-26 20:36:51 +01:00
2025-03-05 23:39:29 +01:00
}
else {
2025-12-26 20:36:51 +01:00
reg import " $script:RegfilesPath \ $path "
2024-06-27 23:08:43 +02:00
}
2023-10-15 19:48:27 +02:00
Write-Output " "
2020-11-04 01:48:42 +01:00
}
2023-08-03 22:24:27 +02:00
2024-06-29 16:18:23 +02:00
# Restart the Windows Explorer process
2023-09-08 00:47:59 +02:00
function RestartExplorer {
2025-12-26 20:36:51 +01:00
Write-Output " > Attempting to restart the Windows Explorer process to apply all changes... "
2025-11-07 22:13:53 +01:00
if ( $script:Params . ContainsKey ( " Sysprep " ) -or $script:Params . ContainsKey ( " User " ) -or $script:Params . ContainsKey ( " NoRestartExplorer " ) ) {
2025-12-26 20:36:51 +01:00
Write-Host " Process restart was skipped, please manually reboot your PC to apply all changes " -ForegroundColor Yellow
2025-02-12 13:07:44 +01:00
return
}
2025-05-10 13:02:48 +02:00
if ( $script:Params . ContainsKey ( " DisableMouseAcceleration " ) ) {
2025-12-26 20:36:51 +01:00
Write-Host " Warning: Changes to the Enhance Pointer Precision setting will only take effect after a reboot " -ForegroundColor Yellow
2025-04-16 12:56:37 +02:00
}
2025-05-10 13:02:48 +02:00
if ( $script:Params . ContainsKey ( " DisableStickyKeys " ) ) {
2025-12-26 20:36:51 +01:00
Write-Host " Warning: Changes to the Sticky Keys setting will only take effect after a reboot " -ForegroundColor Yellow
2025-02-13 21:08:47 +01:00
}
2025-06-12 21:50:57 +02:00
if ( $script:Params . ContainsKey ( " DisableAnimations " ) ) {
Write-Host " Warning: Animations will only be disabled after a reboot " -ForegroundColor Yellow
}
2025-02-12 13:07:44 +01:00
# Only restart if the powershell process matches the OS architecture.
2025-05-25 20:25:06 +02:00
# Restarting explorer from a 32bit PowerShell window will fail on a 64bit OS
2025-02-12 13:07:44 +01:00
if ( [ Environment ] :: Is64BitProcess -eq [ Environment ] :: Is64BitOperatingSystem ) {
2025-12-26 20:36:51 +01:00
Write-Output " Restarting the Windows Explorer process... (This may cause your screen to flicker) "
2024-06-05 19:53:59 +02:00
Stop-Process -processName: Explorer -Force
2024-06-05 19:18:01 +02:00
}
else {
2025-12-26 20:36:51 +01:00
Write-Host " Unable to restart Windows Explorer process, please manually reboot your PC to apply all changes " -ForegroundColor Yellow
2024-06-05 19:18:01 +02:00
}
2023-09-08 00:47:59 +02:00
}
2024-08-15 22:03:48 +02:00
# Replace the startmenu for all users, when using the default startmenuTemplate this clears all pinned apps
2023-09-08 00:47:59 +02:00
# Credit: https://lazyadmin.nl/win-11/customize-windows-11-start-menu-layout/
2024-08-15 22:03:48 +02:00
function ReplaceStartMenuForAllUsers {
2024-01-31 22:19:50 +01:00
param (
2025-12-26 20:36:51 +01:00
$startMenuTemplate = " $script:AssetsPath /Start/start2.bin "
2023-09-08 00:47:59 +02:00
)
2024-08-15 22:03:48 +02:00
Write-Output " > Removing all pinned apps from the start menu for all users... "
2023-09-08 00:47:59 +02:00
2025-12-26 20:36:51 +01:00
# Check if template bin file exists
2024-08-15 22:03:48 +02:00
if ( -not ( Test-Path $startMenuTemplate ) ) {
2024-05-14 23:56:58 +02:00
Write-Host " Error: Unable to clear start menu, start2.bin file missing from script folder " -ForegroundColor Red
2024-08-17 00:08:09 +02:00
Write-Output " "
2024-05-14 23:56:58 +02:00
return
}
2024-08-15 22:03:48 +02:00
# Get path to start menu file for all users
2025-09-07 15:04:29 +02:00
$userPathString = GetUserDirectory -userName " * " -fileName " AppData\Local\Packages\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\LocalState "
2024-08-31 22:13:59 +02:00
$usersStartMenuPaths = get-childitem -path $userPathString
2023-09-08 00:47:59 +02:00
2024-08-15 22:03:48 +02:00
# Go through all users and replace the start menu file
ForEach ( $startMenuPath in $usersStartMenuPaths ) {
2025-06-11 00:05:10 +02:00
ReplaceStartMenu $startMenuTemplate " $( $startMenuPath . Fullname ) \start2.bin "
2024-08-15 22:03:48 +02:00
}
2024-06-27 23:08:43 +02:00
2024-08-15 22:03:48 +02:00
# Also replace the start menu file for the default user profile
2025-09-08 19:54:13 +02:00
$defaultStartMenuPath = GetUserDirectory -userName " Default " -fileName " AppData\Local\Packages\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\LocalState " -exitIfPathNotFound $false
2024-06-27 23:08:43 +02:00
2024-08-15 22:03:48 +02:00
# Create folder if it doesn't exist
2025-05-07 15:51:01 +02:00
if ( -not ( Test-Path $defaultStartMenuPath ) ) {
2024-08-31 22:13:59 +02:00
new-item $defaultStartMenuPath -ItemType Directory -Force | Out-Null
Write-Output " Created LocalState folder for default user profile "
2024-08-15 22:03:48 +02:00
}
2024-06-27 23:08:43 +02:00
2024-08-15 22:03:48 +02:00
# Copy template to default profile
2024-08-31 22:13:59 +02:00
Copy-Item -Path $startMenuTemplate -Destination $defaultStartMenuPath -Force
2024-08-15 22:03:48 +02:00
Write-Output " Replaced start menu for the default user profile "
Write-Output " "
}
2024-06-27 23:08:43 +02:00
2024-08-15 22:03:48 +02:00
# Replace the startmenu for all users, when using the default startmenuTemplate this clears all pinned apps
# Credit: https://lazyadmin.nl/win-11/customize-windows-11-start-menu-layout/
function ReplaceStartMenu {
param (
2025-12-26 20:36:51 +01:00
$startMenuTemplate = " $script:AssetsPath /Start/start2.bin " ,
2025-05-19 00:01:49 +02:00
$startMenuBinFile = " $env:LOCALAPPDATA \Packages\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\LocalState\start2.bin "
2024-08-15 22:03:48 +02:00
)
2024-06-27 23:08:43 +02:00
2025-03-05 23:39:29 +01:00
# Change path to correct user if a user was specified
2025-05-10 13:02:48 +02:00
if ( $script:Params . ContainsKey ( " User " ) ) {
2025-09-28 18:48:06 +02:00
$startMenuBinFile = GetUserDirectory -userName " $( GetUserName ) " -fileName " AppData\Local\Packages\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\LocalState\start2.bin " -exitIfPathNotFound $false
2025-03-05 23:39:29 +01:00
}
2024-06-27 23:08:43 +02:00
2025-12-26 20:36:51 +01:00
# Check if template bin file exists
2024-08-15 22:03:48 +02:00
if ( -not ( Test-Path $startMenuTemplate ) ) {
2025-05-19 20:30:11 +02:00
Write-Host " Error: Unable to replace start menu, template file not found " -ForegroundColor Red
return
}
if ( [ IO.Path ] :: GetExtension ( $startMenuTemplate ) -ne " .bin " ) {
Write-Host " Error: Unable to replace start menu, template file is not a valid .bin file " -ForegroundColor Red
2024-08-15 22:03:48 +02:00
return
2024-06-27 23:08:43 +02:00
}
2023-09-08 00:47:59 +02:00
2025-09-07 15:04:29 +02:00
$userName = [ regex ] :: Match ( $startMenuBinFile , '(?:Users\\)([^\\]+)(?:\\AppData)' ) . Groups [ 1 ] . Value
2024-08-15 22:03:48 +02:00
$backupBinFile = $startMenuBinFile + " .bak "
2023-09-12 02:59:25 +02:00
2025-09-28 18:48:06 +02:00
if ( Test-Path $startMenuBinFile ) {
# Backup current start menu file
Move-Item -Path $startMenuBinFile -Destination $backupBinFile -Force
2025-12-15 23:22:29 +01:00
}
else {
2025-12-26 20:36:51 +01:00
Write-Host " Unable to find original start2.bin file for user $userName , no backup was created for this user " -ForegroundColor Yellow
2025-09-28 20:40:24 +02:00
New-Item -ItemType File -Path $startMenuBinFile -Force
2025-09-28 18:48:06 +02:00
}
2024-08-15 22:03:48 +02:00
# Copy template file
Copy-Item -Path $startMenuTemplate -Destination $startMenuBinFile -Force
2025-09-07 15:04:29 +02:00
Write-Output " Replaced start menu for user $userName "
2023-12-15 13:22:35 +01:00
}
# Add parameter to script and write to file
function AddParameter {
2024-01-31 22:19:50 +01:00
param (
2023-12-15 13:22:35 +01:00
$parameterName ,
2025-12-26 20:36:51 +01:00
$value = $true
2023-12-15 13:22:35 +01:00
)
2025-12-26 20:36:51 +01:00
# Add parameter or update its value if key already exists
2025-05-10 13:02:48 +02:00
if ( -not $script:Params . ContainsKey ( $parameterName ) ) {
2025-12-26 20:36:51 +01:00
$script:Params . Add ( $parameterName , $value )
2023-12-15 13:22:35 +01:00
}
2025-12-26 20:36:51 +01:00
else {
$script:Params [ $parameterName ] = $value
2025-09-27 14:19:41 +02:00
}
2025-12-26 20:36:51 +01:00
}
2025-09-27 14:19:41 +02:00
2025-12-26 20:36:51 +01:00
# Saves the current settings, excluding control parameters, to a JSON file
function SaveSettings {
$settings = @ {
" Version " = " 1.0 "
" Settings " = @ ( )
2023-12-15 13:22:35 +01:00
}
2024-02-23 12:25:11 +01:00
2025-12-26 20:36:51 +01:00
foreach ( $param in $script:Params . Keys ) {
if ( $script:ControlParams -notcontains $param ) {
$value = $script:Params [ $param ]
2023-12-15 13:22:35 +01:00
2025-12-26 20:36:51 +01:00
$settings . Settings + = @ {
" Name " = $param
" Value " = $value
}
}
}
try {
$settings | ConvertTo-Json -Depth 10 | Set-Content $script:SavedSettingsFilePath
}
catch {
Write-Output " "
Write-Host " Error: Failed to save settings to LastUsedSettings.json file " -ForegroundColor Red
}
2023-12-15 13:22:35 +01:00
}
2025-12-26 20:36:51 +01:00
# Prints the header for the script
2023-12-15 13:22:35 +01:00
function PrintHeader {
2024-01-31 22:19:50 +01:00
param (
2023-12-15 13:22:35 +01:00
$title
)
2024-06-27 23:08:43 +02:00
$fullTitle = " Win11Debloat Script - $title "
2025-05-10 13:02:48 +02:00
if ( $script:Params . ContainsKey ( " Sysprep " ) ) {
2024-06-27 23:08:43 +02:00
$fullTitle = " $fullTitle (Sysprep mode) "
}
2024-07-17 19:45:00 +02:00
else {
2025-03-06 19:50:34 +01:00
$fullTitle = " $fullTitle (User: $( GetUserName ) ) "
2024-07-17 19:45:00 +02:00
}
2023-12-15 13:22:35 +01:00
Clear-Host
2025-12-15 23:22:29 +01:00
Write-Host " ------------------------------------------------------------------------------------------- "
Write-Host $fullTitle
Write-Host " ------------------------------------------------------------------------------------------- "
2023-12-15 13:22:35 +01:00
}
2025-12-26 20:36:51 +01:00
# Prints the contents of a file to the console
2023-12-15 13:22:35 +01:00
function PrintFromFile {
2024-01-31 22:19:50 +01:00
param (
2025-05-07 15:51:42 +02:00
$path ,
2025-09-13 23:36:38 +02:00
$title ,
$printHeader = $true
2023-12-15 13:22:35 +01:00
)
2025-09-13 23:36:38 +02:00
if ( $printHeader ) {
Clear-Host
2023-12-15 13:22:35 +01:00
2025-09-13 23:36:38 +02:00
PrintHeader $title
}
2025-05-07 15:51:42 +02:00
2023-12-15 13:22:35 +01:00
# Get & print script menu from file
Foreach ( $line in ( Get-Content -Path $path ) ) {
2025-12-15 23:22:29 +01:00
Write-Host $line
2023-12-15 13:22:35 +01:00
}
2023-09-08 00:47:59 +02:00
}
2025-12-26 20:36:51 +01:00
# Prints all pending changes that will be made by the script
function PrintPendingChanges {
Write-Output " Win11Debloat will make the following changes: "
2025-09-27 14:19:41 +02:00
2025-12-26 20:36:51 +01:00
if ( $script:Params [ 'CreateRestorePoint' ] ) {
Write-Output " - $( $script:Features [ 'CreateRestorePoint' ] ) "
2025-09-27 14:19:41 +02:00
}
2025-12-26 20:36:51 +01:00
foreach ( $parameterName in $script:Params . Keys ) {
if ( $script:ControlParams -contains $parameterName ) {
continue
}
2025-09-28 18:21:14 +02:00
2025-12-26 20:36:51 +01:00
# Print parameter description
switch ( $parameterName ) {
'Apps' {
continue
}
'CreateRestorePoint' {
continue
}
'RemoveApps' {
$appsList = GenerateAppsList
if ( $appsList . Count -eq 0 ) {
Write-Host " No valid apps were selected for removal " -ForegroundColor Yellow
Write-Output " "
continue
}
Write-Output " - Remove $( $appsList . Count ) apps: "
Write-Host $appsList -ForegroundColor DarkGray
continue
}
'RemoveAppsCustom' {
$appsList = ReadAppslistFromFile $script:CustomAppsListFilePath
if ( $appsList . Count -eq 0 ) {
Write-Host " No valid apps were selected for removal " -ForegroundColor Yellow
Write-Output " "
continue
}
Write-Output " - Remove $( $appsList . Count ) apps: "
Write-Host $appsList -ForegroundColor DarkGray
continue
}
default {
if ( $script:Features -and $script:Features . ContainsKey ( $parameterName ) ) {
$message = $script:Features [ $parameterName ]
Write-Output " - $message "
}
else {
# Fallback: show the parameter name if no feature description is available
Write-Output " - $parameterName "
}
continue
}
}
}
Write-Output " "
Write-Output " "
Write-Output " Press enter to execute the script or press CTRL+C to quit... "
Read-Host | Out-Null
}
# Generates a list of apps to remove based on the Apps parameter
function GenerateAppsList {
if ( -not ( $script:Params [ " Apps " ] -and $script:Params [ " Apps " ] -is [ string ] ) ) {
return @ ( )
2025-09-28 18:21:14 +02:00
}
2025-12-26 20:36:51 +01:00
$appMode = $script:Params [ " Apps " ] . toLower ( )
switch ( $appMode ) {
'default' {
$appsList = ReadAppslistFromFile $script:AppsListFilePath
return $appsList
}
default {
$appsList = $script:Params [ " Apps " ] . Split ( ',' ) | ForEach-Object { $_ . Trim ( ) }
$validatedAppsList = ValidateAppslist $appsList
return $validatedAppsList
}
}
2025-09-27 14:19:41 +02:00
}
2024-04-05 18:26:58 +02:00
function AwaitKeyToExit {
# Suppress prompt if Silent parameter was passed
if ( -not $Silent ) {
Write-Output " "
Write-Output " Press any key to exit... "
$null = [ System.Console ] :: ReadKey ( )
}
2025-05-10 16:42:03 +02:00
Stop-Transcript
Exit
2024-04-05 18:26:58 +02:00
}
2025-03-05 23:39:29 +01:00
function GetUserName {
2025-12-26 20:36:51 +01:00
if ( $script:Params . ContainsKey ( " User " ) ) {
return $script:Params . Item ( " User " )
2025-03-05 23:39:29 +01:00
}
2025-12-26 20:36:51 +01:00
2025-05-04 23:33:20 +02:00
return $env:USERNAME
2025-03-05 23:39:29 +01:00
}
2025-05-03 17:55:31 +02:00
function CreateSystemRestorePoint {
2025-05-05 22:47:31 +02:00
Write-Output " > Attempting to create a system restore point... "
2025-12-26 20:36:51 +01:00
2025-05-05 22:47:31 +02:00
$SysRestore = Get-ItemProperty -Path " HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore " -Name " RPSessionInterval "
if ( $SysRestore . RPSessionInterval -eq 0 ) {
2025-05-05 23:46:45 +02:00
if ( $Silent -or $ ( Read-Host -Prompt " System restore is disabled, would you like to enable it and create a restore point? (y/n) " ) -eq 'y' ) {
2025-12-26 20:36:51 +01:00
$enableSystemRestoreJob = Start-Job {
2025-08-16 01:37:43 +02:00
try {
Enable-ComputerRestore -Drive " $env:SystemDrive "
2025-12-15 23:22:29 +01:00
}
catch {
2025-08-16 01:37:43 +02:00
Write-Host " Error: Failed to enable System Restore: $_ " -ForegroundColor Red
return
}
}
2025-12-26 20:36:51 +01:00
2025-08-16 01:37:43 +02:00
$enableSystemRestoreJobDone = $enableSystemRestoreJob | Wait-Job -TimeOut 20
if ( -not $enableSystemRestoreJobDone ) {
Write-Host " Error: Failed to enable system restore and create restore point, operation timed out " -ForegroundColor Red
2025-05-05 22:47:31 +02:00
return
2025-12-15 23:22:29 +01:00
}
else {
2025-08-16 02:03:53 +02:00
Receive-Job $enableSystemRestoreJob
2025-05-05 22:47:31 +02:00
}
2025-12-15 23:22:29 +01:00
}
else {
2025-05-05 23:46:45 +02:00
Write-Output " "
return
2025-05-05 22:47:31 +02:00
}
}
2025-05-03 17:55:31 +02:00
2025-12-26 20:36:51 +01:00
$createRestorePointJob = Start-Job {
2025-08-16 01:37:43 +02:00
# Find existing restore points that are less than 24 hours old
2025-05-04 22:35:58 +02:00
try {
2025-08-16 01:37:43 +02:00
$recentRestorePoints = Get-ComputerRestorePoint | Where-Object { ( Get-Date ) - [ System.Management.ManagementDateTimeConverter ] :: ToDateTime ( $_ . CreationTime ) -le ( New-TimeSpan -Hours 24 ) }
2025-12-15 23:22:29 +01:00
}
catch {
2025-08-16 01:37:43 +02:00
Write-Host " Error: Unable to retrieve existing restore points: $_ " -ForegroundColor Red
return
2025-05-04 22:35:58 +02:00
}
2025-12-26 20:36:51 +01:00
2025-08-16 01:37:43 +02:00
if ( $recentRestorePoints . Count -eq 0 ) {
try {
Checkpoint-Computer -Description " Restore point created by Win11Debloat " -RestorePointType " MODIFY_SETTINGS "
Write-Output " System restore point created successfully "
2025-12-15 23:22:29 +01:00
}
catch {
2025-08-16 01:37:43 +02:00
Write-Host " Error: Unable to create restore point: $_ " -ForegroundColor Red
}
2025-12-15 23:22:29 +01:00
}
else {
2025-12-26 20:36:51 +01:00
Write-Host " A recent restore point already exists, no new restore point was created " -ForegroundColor Yellow
2025-08-16 01:37:43 +02:00
}
}
2025-12-26 20:36:51 +01:00
2025-08-16 01:37:43 +02:00
$createRestorePointJobDone = $createRestorePointJob | Wait-Job -TimeOut 20
if ( -not $createRestorePointJobDone ) {
Write-Host " Error: Failed to create system restore point, operation timed out " -ForegroundColor Red
2025-12-15 23:22:29 +01:00
}
else {
2025-08-16 02:03:53 +02:00
Receive-Job $createRestorePointJob
2025-05-03 17:55:31 +02:00
}
Write-Output " "
}
2025-12-15 23:22:29 +01:00
function ShowScriptMenuOptions {
Do {
$ModeSelectionMessage = " Please select an option (1/2/3/0) "
PrintHeader 'Menu'
Write-Host " (1) Default mode: Quickly apply the recommended changes "
Write-Host " (2) Custom mode: Manually select what changes to make "
Write-Host " (3) App removal mode: Select & remove apps, without making other changes "
# Only show this option if SavedSettings file exists
2025-12-26 20:36:51 +01:00
if ( Test-Path $script:SavedSettingsFilePath ) {
2025-12-27 15:51:10 +01:00
Write-Host " (4) Quickly apply your last used settings "
2025-12-15 23:22:29 +01:00
$ModeSelectionMessage = " Please select an option (1/2/3/4/0) "
}
Write-Host " "
Write-Host " (0) Show more information "
Write-Host " "
Write-Host " "
$Mode = Read-Host $ModeSelectionMessage
if ( $Mode -eq '0' ) {
# Print information screen from file
2025-12-26 20:36:51 +01:00
PrintFromFile " $script:AssetsPath /Menus/Info " " Information "
2025-12-15 23:22:29 +01:00
Write-Host " Press any key to go back... "
$null = [ System.Console ] :: ReadKey ( )
}
2025-12-26 20:36:51 +01:00
elseif ( ( $Mode -eq '4' ) -and -not ( Test-Path $script:SavedSettingsFilePath ) ) {
2025-12-15 23:22:29 +01:00
$Mode = $null
}
}
while ( $Mode -ne '1' -and $Mode -ne '2' -and $Mode -ne '3' -and $Mode -ne '4' )
return $Mode
}
2025-12-26 20:36:51 +01:00
function ShowDefaultModeOptions {
2025-12-15 23:22:29 +01:00
# Show options for removing apps, or set selection if RunDefaults or RunDefaultsLite parameter was passed
if ( $RunDefaults ) {
$RemoveAppsInput = '1'
}
elseif ( $RunDefaultsLite ) {
$RemoveAppsInput = '0'
}
else {
$RemoveAppsInput = ShowDefaultModeAppRemovalOptions
2025-12-26 20:36:51 +01:00
if ( $RemoveAppsInput -eq '2' -and ( $script:SelectedApps . contains ( 'Microsoft.XboxGameOverlay' ) -or $script:SelectedApps . contains ( 'Microsoft.XboxGamingOverlay' ) ) -and
2025-12-16 23:25:17 +01:00
$ ( Read-Host -Prompt " Disable Game Bar integration and game/screen recording? This also stops ms-gamingoverlay and ms-gamebar popups (y/n) " ) -eq 'y' ) {
$DisableGameBarIntegrationInput = $true ;
2025-12-15 23:22:29 +01:00
}
}
2025-12-26 21:51:34 +01:00
PrintHeader 'Default Mode'
2025-12-26 20:36:51 +01:00
# Add default settings based on user input
try {
$defaultSettings = ( Get-Content -Path $script:DefaultSettingsFilePath -Raw | ConvertFrom-Json )
if ( -not $defaultSettings . Version -or $defaultSettings . Version -ne " 1.0 " ) {
2025-12-26 21:51:34 +01:00
Write-Error " DefaultSettings.json version mismatch (expected 1.0, found $( $defaultSettings . Version ) ) "
AwaitKeyToExit
2025-12-26 20:36:51 +01:00
}
2025-12-15 23:22:29 +01:00
2025-12-26 20:36:51 +01:00
# Select app removal options based on user input
switch ( $RemoveAppsInput ) {
'1' {
AddParameter 'RemoveApps'
AddParameter 'Apps' 'Default'
}
'2' {
AddParameter 'RemoveAppsCustom'
2025-12-15 23:22:29 +01:00
2025-12-26 20:36:51 +01:00
if ( $DisableGameBarIntegrationInput ) {
AddParameter 'DisableDVR'
AddParameter 'DisableGameBarIntegration'
}
}
2025-12-15 23:22:29 +01:00
}
2025-12-26 20:36:51 +01:00
Foreach ( $setting in $defaultSettings . Settings ) {
if ( $setting . Value -eq $false ) {
continue
}
AddParameter $setting . Name $setting . Value
2025-12-15 23:22:29 +01:00
}
}
2025-12-26 20:36:51 +01:00
catch {
Write-Error " Failed to load settings from DefaultSettings.json file "
AwaitKeyToExit
2025-12-15 23:22:29 +01:00
}
2025-12-26 20:36:51 +01:00
SaveSettings
2025-12-15 23:22:29 +01:00
2025-12-26 20:36:51 +01:00
# Skip change summary if Silent parameter was passed
if ( $Silent ) {
return
2025-12-15 23:22:29 +01:00
}
2025-12-26 20:36:51 +01:00
PrintPendingChanges
2025-12-15 23:22:29 +01:00
PrintHeader 'Default Mode'
}
function ShowDefaultModeAppRemovalOptions {
PrintHeader 'Default Mode'
2025-12-26 20:36:51 +01:00
Write-Host " Please note: The default selection of apps includes Microsoft Teams, Spotify, Sticky Notes and more. Select option 2 to verify and change what apps are removed by the script " -ForegroundColor DarkGray
2025-12-15 23:22:29 +01:00
Write-Host " "
Do {
Write-Host " Options: " -ForegroundColor Yellow
Write-Host " (n) Don't remove any apps " -ForegroundColor Yellow
Write-Host " (1) Only remove the default selection of apps " -ForegroundColor Yellow
Write-Host " (2) Manually select which apps to remove " -ForegroundColor Yellow
$RemoveAppsInput = Read-Host " Do you want to remove any apps? Apps will be removed for all users (n/1/2) "
# Show app selection form if user entered option 3
if ( $RemoveAppsInput -eq '2' ) {
$result = ShowAppSelectionForm
if ( $result -ne [ System.Windows.Forms.DialogResult ] :: OK ) {
2025-12-26 20:36:51 +01:00
# User cancelled or closed app selection, change RemoveAppsInput so the menu will be shown again
2025-12-15 23:22:29 +01:00
Write-Host " "
Write-Host " Cancelled application selection, please try again " -ForegroundColor Red
$RemoveAppsInput = 'c'
}
Write-Host " "
}
}
while ( $RemoveAppsInput -ne 'n' -and $RemoveAppsInput -ne '0' -and $RemoveAppsInput -ne '1' -and $RemoveAppsInput -ne '2' )
return $RemoveAppsInput
}
function ShowCustomModeOptions {
2025-02-13 21:08:47 +01:00
# Get current Windows build version to compare against features
$WinVersion = Get-ItemPropertyValue 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' CurrentBuild
2025-12-26 20:36:51 +01:00
2025-02-13 21:08:47 +01:00
PrintHeader 'Custom Mode'
2025-12-26 20:36:51 +01:00
AddParameter 'CreateRestorePoint'
2025-05-03 17:55:31 +02:00
2025-02-13 21:08:47 +01:00
# Show options for removing apps, only continue on valid input
Do {
Write-Host " Options: " -ForegroundColor Yellow
Write-Host " (n) Don't remove any apps " -ForegroundColor Yellow
2025-09-27 14:19:41 +02:00
Write-Host " (1) Only remove the default selection of apps " -ForegroundColor Yellow
2025-10-06 21:51:19 +02:00
Write-Host " (2) Remove the default selection of apps, as well as mail & calendar apps and gaming related apps " -ForegroundColor Yellow
2025-06-12 21:05:23 +02:00
Write-Host " (3) Manually select which apps to remove " -ForegroundColor Yellow
$RemoveAppsInput = Read-Host " Do you want to remove any apps? Apps will be removed for all users (n/1/2/3) "
2025-02-13 21:08:47 +01:00
# Show app selection form if user entered option 3
if ( $RemoveAppsInput -eq '3' ) {
$result = ShowAppSelectionForm
if ( $result -ne [ System.Windows.Forms.DialogResult ] :: OK ) {
2025-12-26 20:36:51 +01:00
# User cancelled or closed app selection, change RemoveAppsInput so the menu will be shown again
2025-02-13 21:08:47 +01:00
Write-Output " "
Write-Host " Cancelled application selection, please try again " -ForegroundColor Red
$RemoveAppsInput = 'c'
}
2025-12-26 20:36:51 +01:00
2025-02-13 21:08:47 +01:00
Write-Output " "
}
}
2025-12-26 20:36:51 +01:00
while ( $RemoveAppsInput -ne 'n' -and $RemoveAppsInput -ne '0' -and $RemoveAppsInput -ne '1' -and $RemoveAppsInput -ne '2' -and $RemoveAppsInput -ne '3' )
2025-02-13 21:08:47 +01:00
# Select correct option based on user input
switch ( $RemoveAppsInput ) {
'1' {
2025-12-26 20:36:51 +01:00
AddParameter 'RemoveApps'
AddParameter 'Apps' 'Default'
2025-02-13 21:08:47 +01:00
}
'2' {
2025-12-26 20:36:51 +01:00
AddParameter 'RemoveApps'
AddParameter 'Apps' 'Default'
AddParameter 'RemoveCommApps'
AddParameter 'RemoveW11Outlook'
AddParameter 'RemoveGamingApps'
Write-Output " "
if ( $ ( Read-Host -Prompt " Disable Game Bar integration and game/screen recording? This also stops ms-gamingoverlay and ms-gamebar popups (y/n) " ) -eq 'y' ) {
AddParameter 'DisableDVR'
AddParameter 'DisableGameBarIntegration'
}
2025-02-13 21:08:47 +01:00
}
'3' {
2025-05-10 13:02:48 +02:00
Write-Output " You have selected $( $script:SelectedApps . Count ) apps for removal "
2025-02-13 21:08:47 +01:00
2025-12-26 20:36:51 +01:00
AddParameter 'RemoveAppsCustom'
2025-02-13 21:08:47 +01:00
Write-Output " "
2025-12-26 20:36:51 +01:00
if ( $ ( Read-Host -Prompt " Disable Game Bar integration and game/screen recording? This also stops ms-gamingoverlay and ms-gamebar popups (y/n) " ) -eq 'y' ) {
AddParameter 'DisableDVR'
AddParameter 'DisableGameBarIntegration'
2025-02-13 21:08:47 +01:00
}
}
}
Write-Output " "
if ( $ ( Read-Host -Prompt " Disable telemetry, diagnostic data, activity history, app-launch tracking and targeted ads? (y/n) " ) -eq 'y' ) {
2025-12-26 20:36:51 +01:00
AddParameter 'DisableTelemetry'
2025-02-13 21:08:47 +01:00
}
Write-Output " "
2025-09-12 00:08:15 +02:00
if ( $ ( Read-Host -Prompt " Disable tips, tricks, suggestions and ads in start, settings, notifications, explorer, lockscreen and Edge? (y/n) " ) -eq 'y' ) {
2025-12-26 20:36:51 +01:00
AddParameter 'DisableSuggestions'
AddParameter 'DisableEdgeAds'
AddParameter 'DisableSettings365Ads'
AddParameter 'DisableLockscreenTips'
2025-02-13 21:08:47 +01:00
}
Write-Output " "
2025-06-11 12:16:55 +02:00
if ( $ ( Read-Host -Prompt " Disable & remove Bing web search, Bing AI and Cortana from Windows search? (y/n) " ) -eq 'y' ) {
2025-12-26 20:36:51 +01:00
AddParameter 'DisableBing'
2025-02-13 21:08:47 +01:00
}
# Only show this option for Windows 11 users running build 22621 or later
2025-05-16 18:26:06 +02:00
if ( $WinVersion -ge 22621 ) {
2025-02-13 21:08:47 +01:00
Write-Output " "
2025-08-01 21:21:38 +02:00
# Show options for disabling/removing AI features, only continue on valid input
Do {
Write-Host " Options: " -ForegroundColor Yellow
Write-Host " (n) Don't disable any AI features " -ForegroundColor Yellow
2025-09-17 23:33:52 +02:00
Write-Host " (1) Disable Microsoft Copilot, Windows Recall and Click to Do " -ForegroundColor Yellow
Write-Host " (2) Disable Microsoft Copilot, Windows Recall, Click to Do and AI features in Microsoft Edge, Paint and Notepad " -ForegroundColor Yellow
2025-08-01 21:21:38 +02:00
$DisableAIInput = Read-Host " Do you want to disable any AI features? This applies to all users (n/1/2) "
}
2025-12-26 20:36:51 +01:00
while ( $DisableAIInput -ne 'n' -and $DisableAIInput -ne '0' -and $DisableAIInput -ne '1' -and $DisableAIInput -ne '2' )
2025-08-01 21:21:38 +02:00
# Select correct option based on user input
switch ( $DisableAIInput ) {
'1' {
2025-12-26 20:36:51 +01:00
AddParameter 'DisableCopilot'
AddParameter 'DisableRecall'
AddParameter 'DisableClickToDo'
2025-08-01 21:21:38 +02:00
}
'2' {
2025-12-26 20:36:51 +01:00
AddParameter 'DisableCopilot'
AddParameter 'DisableRecall'
AddParameter 'DisableClickToDo'
AddParameter 'DisableEdgeAI'
AddParameter 'DisablePaintAI'
AddParameter 'DisableNotepadAI'
2025-08-01 21:21:38 +02:00
}
2025-02-13 21:08:47 +01:00
}
}
2025-05-20 20:38:47 +02:00
Write-Output " "
if ( $ ( Read-Host -Prompt " Disable Windows Spotlight background on desktop? (y/n) " ) -eq 'y' ) {
2025-12-26 20:36:51 +01:00
AddParameter 'DisableDesktopSpotlight'
2025-05-20 20:38:47 +02:00
}
2025-06-12 21:50:57 +02:00
Write-Output " "
if ( $ ( Read-Host -Prompt " Enable dark mode for system and apps? (y/n) " ) -eq 'y' ) {
2025-12-26 20:36:51 +01:00
AddParameter 'EnableDarkMode'
2025-06-12 21:50:57 +02:00
}
Write-Output " "
if ( $ ( Read-Host -Prompt " Disable transparency, animations and visual effects? (y/n) " ) -eq 'y' ) {
2025-12-26 20:36:51 +01:00
AddParameter 'DisableTransparency'
AddParameter 'DisableAnimations'
2025-06-12 21:50:57 +02:00
}
2025-02-13 21:08:47 +01:00
# Only show this option for Windows 11 users running build 22000 or later
2025-05-16 18:26:06 +02:00
if ( $WinVersion -ge 22000 ) {
2025-02-13 21:08:47 +01:00
Write-Output " "
if ( $ ( Read-Host -Prompt " Restore the old Windows 10 style context menu? (y/n) " ) -eq 'y' ) {
2025-12-26 20:36:51 +01:00
AddParameter 'RevertContextMenu'
2025-02-13 21:08:47 +01:00
}
}
Write-Output " "
if ( $ ( Read-Host -Prompt " Turn off Enhance Pointer Precision, also known as mouse acceleration? (y/n) " ) -eq 'y' ) {
2025-12-26 20:36:51 +01:00
AddParameter 'DisableMouseAcceleration'
2025-02-13 21:08:47 +01:00
}
2025-04-16 12:56:37 +02:00
# Only show this option for Windows 11 users running build 26100 or later
2025-05-16 18:26:06 +02:00
if ( $WinVersion -ge 26100 ) {
2025-04-16 12:56:37 +02:00
Write-Output " "
if ( $ ( Read-Host -Prompt " Disable the Sticky Keys keyboard shortcut? (y/n) " ) -eq 'y' ) {
2025-12-26 20:36:51 +01:00
AddParameter 'DisableStickyKeys'
2025-04-16 12:56:37 +02:00
}
}
2025-05-01 22:32:41 +01:00
Write-Output " "
2025-06-11 12:33:14 +02:00
if ( $ ( Read-Host -Prompt " Disable Fast Start-up? This applies to all users (y/n) " ) -eq 'y' ) {
2025-12-26 20:36:51 +01:00
AddParameter 'DisableFastStartup'
2025-05-01 22:32:41 +01:00
}
2025-08-19 23:24:28 +05:30
# Only show this option for Windows 11 users running build 22000 or later, and if the machine has at least one battery
2025-08-22 17:50:47 +02:00
if ( ( $WinVersion -ge 22000 ) -and $script:ModernStandbySupported ) {
2025-08-19 23:24:28 +05:30
Write-Output " "
2025-08-22 17:50:47 +02:00
if ( $ ( Read-Host -Prompt " Disable network connectivity during Modern Standby? This applies to all users (y/n) " ) -eq 'y' ) {
2025-12-26 20:36:51 +01:00
AddParameter 'DisableModernStandbyNetworking'
2025-08-19 23:24:28 +05:30
}
}
2025-02-13 21:08:47 +01:00
# Only show option for disabling context menu items for Windows 10 users or if the user opted to restore the Windows 10 context menu
2025-05-16 18:26:06 +02:00
if ( ( get-ciminstance -query " select caption from win32_operatingsystem where caption like '%Windows 10%' " ) -or $script:Params . ContainsKey ( 'RevertContextMenu' ) ) {
2025-02-13 21:08:47 +01:00
Write-Output " "
if ( $ ( Read-Host -Prompt " Do you want to disable any context menu options? (y/n) " ) -eq 'y' ) {
Write-Output " "
if ( $ ( Read-Host -Prompt " Hide the 'Include in library' option in the context menu? (y/n) " ) -eq 'y' ) {
2025-12-26 20:36:51 +01:00
AddParameter 'HideIncludeInLibrary'
2025-02-13 21:08:47 +01:00
}
Write-Output " "
if ( $ ( Read-Host -Prompt " Hide the 'Give access to' option in the context menu? (y/n) " ) -eq 'y' ) {
2025-12-26 20:36:51 +01:00
AddParameter 'HideGiveAccessTo'
2025-02-13 21:08:47 +01:00
}
Write-Output " "
if ( $ ( Read-Host -Prompt " Hide the 'Share' option in the context menu? (y/n) " ) -eq 'y' ) {
2025-12-26 20:36:51 +01:00
AddParameter 'HideShare'
2025-02-13 21:08:47 +01:00
}
}
}
# Only show this option for Windows 11 users running build 22621 or later
2025-05-16 18:26:06 +02:00
if ( $WinVersion -ge 22621 ) {
2025-02-13 21:08:47 +01:00
Write-Output " "
if ( $ ( Read-Host -Prompt " Do you want to make any changes to the start menu? (y/n) " ) -eq 'y' ) {
Write-Output " "
2025-05-10 13:02:48 +02:00
if ( $script:Params . ContainsKey ( " Sysprep " ) ) {
2025-02-13 21:08:47 +01:00
if ( $ ( Read-Host -Prompt " Remove all pinned apps from the start menu for all existing and new users? (y/n) " ) -eq 'y' ) {
2025-12-26 20:36:51 +01:00
AddParameter 'ClearStartAllUsers'
2025-02-13 21:08:47 +01:00
}
}
else {
Do {
Write-Host " Options: " -ForegroundColor Yellow
Write-Host " (n) Don't remove any pinned apps from the start menu " -ForegroundColor Yellow
2025-03-05 23:39:29 +01:00
Write-Host " (1) Remove all pinned apps from the start menu for this user only ( $( GetUserName ) ) " -ForegroundColor Yellow
2025-02-13 21:08:47 +01:00
Write-Host " (2) Remove all pinned apps from the start menu for all existing and new users " -ForegroundColor Yellow
2025-12-26 20:36:51 +01:00
$ClearStartInput = Read-Host " Remove all pinned apps from the start menu? (n/1/2) "
2025-02-13 21:08:47 +01:00
}
2025-12-26 20:36:51 +01:00
while ( $ClearStartInput -ne 'n' -and $ClearStartInput -ne '0' -and $ClearStartInput -ne '1' -and $ClearStartInput -ne '2' )
2025-02-13 21:08:47 +01:00
# Select correct option based on user input
switch ( $ClearStartInput ) {
'1' {
2025-12-26 20:36:51 +01:00
AddParameter 'ClearStart'
2025-02-13 21:08:47 +01:00
}
'2' {
2025-12-26 20:36:51 +01:00
AddParameter 'ClearStartAllUsers'
2025-02-13 21:08:47 +01:00
}
}
}
2025-11-14 23:45:06 +01:00
# Don't show option for users running build 26200 and above, as this setting was removed in this build
if ( $WinVersion -lt 26200 ) {
Write-Output " "
2025-02-13 21:08:47 +01:00
2025-11-14 23:45:06 +01:00
if ( $ ( Read-Host -Prompt " Disable the recommended section in the start menu? This applies to all users (y/n) " ) -eq 'y' ) {
2025-12-26 20:36:51 +01:00
AddParameter 'DisableStartRecommended'
2025-11-14 23:45:06 +01:00
}
2025-02-13 21:08:47 +01:00
}
2025-06-11 22:04:17 +02:00
Write-Output " "
if ( $ ( Read-Host -Prompt " Disable the Phone Link mobile devices integration in the start menu? (y/n) " ) -eq 'y' ) {
2025-12-26 20:36:51 +01:00
AddParameter 'DisableStartPhoneLink'
2025-06-11 22:04:17 +02:00
}
2025-02-13 21:08:47 +01:00
}
}
Write-Output " "
if ( $ ( Read-Host -Prompt " Do you want to make any changes to the taskbar and related services? (y/n) " ) -eq 'y' ) {
# Only show these specific options for Windows 11 users running build 22000 or later
2025-05-16 18:26:06 +02:00
if ( $WinVersion -ge 22000 ) {
2025-02-13 21:08:47 +01:00
Write-Output " "
if ( $ ( Read-Host -Prompt " Align taskbar buttons to the left side? (y/n) " ) -eq 'y' ) {
2025-12-26 20:36:51 +01:00
AddParameter 'TaskbarAlignLeft'
2025-02-13 21:08:47 +01:00
}
2025-09-27 14:34:01 +02:00
# Show options for combine icon on taskbar, only continue on valid input
Do {
Write-Output " "
Write-Host " Options: " -ForegroundColor Yellow
Write-Host " (n) No change " -ForegroundColor Yellow
Write-Host " (1) Always " -ForegroundColor Yellow
Write-Host " (2) When taskbar is full " -ForegroundColor Yellow
Write-Host " (3) Never " -ForegroundColor Yellow
2025-12-26 20:36:51 +01:00
$TbCombineTaskbar = Read-Host " Combine taskbar buttons and hide labels? (n/1/2/3) "
2025-09-27 14:34:01 +02:00
}
2025-12-26 20:36:51 +01:00
while ( $TbCombineTaskbar -ne 'n' -and $TbCombineTaskbar -ne '0' -and $TbCombineTaskbar -ne '1' -and $TbCombineTaskbar -ne '2' -and $TbCombineTaskbar -ne '3' )
2025-09-27 14:34:01 +02:00
# Select correct taskbar goup option based on user input
switch ( $TbCombineTaskbar ) {
'1' {
2025-12-26 20:36:51 +01:00
AddParameter 'CombineTaskbarAlways'
AddParameter 'CombineMMTaskbarAlways'
2025-09-27 14:34:01 +02:00
}
'2' {
2025-12-26 20:36:51 +01:00
AddParameter 'CombineTaskbarWhenFull'
AddParameter 'CombineMMTaskbarWhenFull'
2025-09-27 14:34:01 +02:00
}
'3' {
2025-12-26 20:36:51 +01:00
AddParameter 'CombineTaskbarNever'
AddParameter 'CombineMMTaskbarNever'
2025-10-06 23:33:04 +02:00
}
}
2025-10-06 23:42:02 +02:00
# Show options for changing on what taskbar(s) app icons are shown, only continue on valid input
2025-10-06 23:33:04 +02:00
Do {
Write-Output " "
Write-Host " Options: " -ForegroundColor Yellow
Write-Host " (n) No change " -ForegroundColor Yellow
2025-10-06 23:42:02 +02:00
Write-Host " (1) Show app icons on all taskbars " -ForegroundColor Yellow
Write-Host " (2) Show app icons on main taskbar and on taskbar where the windows is open " -ForegroundColor Yellow
Write-Host " (3) Show app icons only on taskbar where the window is open " -ForegroundColor Yellow
2025-12-26 20:36:51 +01:00
$TbCombineTaskbar = Read-Host " Change how to show app icons on the taskbar when using multiple monitors? (n/1/2/3) "
2025-10-06 23:33:04 +02:00
}
2025-12-26 20:36:51 +01:00
while ( $TbCombineTaskbar -ne 'n' -and $TbCombineTaskbar -ne '0' -and $TbCombineTaskbar -ne '1' -and $TbCombineTaskbar -ne '2' -and $TbCombineTaskbar -ne '3' )
2025-10-06 23:33:04 +02:00
# Select correct taskbar goup option based on user input
switch ( $TbCombineTaskbar ) {
'1' {
2025-12-26 20:36:51 +01:00
AddParameter 'MMTaskbarModeAll'
2025-10-06 23:33:04 +02:00
}
'2' {
2025-12-26 20:36:51 +01:00
AddParameter 'MMTaskbarModeMainActive'
2025-10-06 23:33:04 +02:00
}
'3' {
2025-12-26 20:36:51 +01:00
AddParameter 'MMTaskbarModeActive'
2025-09-27 14:34:01 +02:00
}
}
2025-02-13 21:08:47 +01:00
# Show options for search icon on taskbar, only continue on valid input
Do {
Write-Output " "
Write-Host " Options: " -ForegroundColor Yellow
Write-Host " (n) No change " -ForegroundColor Yellow
Write-Host " (1) Hide search icon from the taskbar " -ForegroundColor Yellow
Write-Host " (2) Show search icon on the taskbar " -ForegroundColor Yellow
Write-Host " (3) Show search icon with label on the taskbar " -ForegroundColor Yellow
Write-Host " (4) Show search box on the taskbar " -ForegroundColor Yellow
2025-12-26 20:36:51 +01:00
$TbSearchInput = Read-Host " Hide or change the search icon on the taskbar? (n/1/2/3/4) "
2025-02-13 21:08:47 +01:00
}
2025-12-26 20:36:51 +01:00
while ( $TbSearchInput -ne 'n' -and $TbSearchInput -ne '0' -and $TbSearchInput -ne '1' -and $TbSearchInput -ne '2' -and $TbSearchInput -ne '3' -and $TbSearchInput -ne '4' )
2025-02-13 21:08:47 +01:00
# Select correct taskbar search option based on user input
switch ( $TbSearchInput ) {
'1' {
2025-12-26 20:36:51 +01:00
AddParameter 'HideSearchTb'
2025-02-13 21:08:47 +01:00
}
'2' {
2025-12-26 20:36:51 +01:00
AddParameter 'ShowSearchIconTb'
2025-02-13 21:08:47 +01:00
}
'3' {
2025-12-26 20:36:51 +01:00
AddParameter 'ShowSearchLabelTb'
2025-02-13 21:08:47 +01:00
}
'4' {
2025-12-26 20:36:51 +01:00
AddParameter 'ShowSearchBoxTb'
2025-02-13 21:08:47 +01:00
}
}
Write-Output " "
if ( $ ( Read-Host -Prompt " Hide the taskview button from the taskbar? (y/n) " ) -eq 'y' ) {
2025-12-26 20:36:51 +01:00
AddParameter 'HideTaskview'
2025-02-13 21:08:47 +01:00
}
}
Write-Output " "
2025-09-07 19:13:51 +02:00
if ( $ ( Read-Host -Prompt " Disable the widgets service to remove widgets on the taskbar & lockscreen? (y/n) " ) -eq 'y' ) {
2025-12-26 20:36:51 +01:00
AddParameter 'DisableWidgets'
2025-02-13 21:08:47 +01:00
}
# Only show this options for Windows users running build 22621 or earlier
2025-05-16 18:26:06 +02:00
if ( $WinVersion -le 22621 ) {
2025-02-13 21:08:47 +01:00
Write-Output " "
if ( $ ( Read-Host -Prompt " Hide the chat (meet now) icon from the taskbar? (y/n) " ) -eq 'y' ) {
2025-12-26 20:36:51 +01:00
AddParameter 'HideChat'
2025-02-13 21:08:47 +01:00
}
}
2025-12-26 20:36:51 +01:00
2025-04-16 12:31:18 +02:00
# Only show this options for Windows users running build 22631 or later
2025-05-16 18:26:06 +02:00
if ( $WinVersion -ge 22631 ) {
2025-04-16 12:31:18 +02:00
Write-Output " "
if ( $ ( Read-Host -Prompt " Enable the 'End Task' option in the taskbar right click menu? (y/n) " ) -eq 'y' ) {
2025-12-26 20:36:51 +01:00
AddParameter 'EnableEndTask'
2025-04-16 12:31:18 +02:00
}
}
2025-12-26 20:36:51 +01:00
2025-07-30 15:30:51 -04:00
Write-Output " "
if ( $ ( Read-Host -Prompt " Enable the 'Last Active Click' behavior in the taskbar app area? (y/n) " ) -eq 'y' ) {
2025-12-26 20:36:51 +01:00
AddParameter 'EnableLastActiveClick'
2025-07-30 15:30:51 -04:00
}
2025-02-13 21:08:47 +01:00
}
Write-Output " "
if ( $ ( Read-Host -Prompt " Do you want to make any changes to File Explorer? (y/n) " ) -eq 'y' ) {
# Show options for changing the File Explorer default location
Do {
Write-Output " "
Write-Host " Options: " -ForegroundColor Yellow
Write-Host " (n) No change " -ForegroundColor Yellow
Write-Host " (1) Open File Explorer to 'Home' " -ForegroundColor Yellow
Write-Host " (2) Open File Explorer to 'This PC' " -ForegroundColor Yellow
Write-Host " (3) Open File Explorer to 'Downloads' " -ForegroundColor Yellow
Write-Host " (4) Open File Explorer to 'OneDrive' " -ForegroundColor Yellow
2025-12-26 20:36:51 +01:00
$ExplSearchInput = Read-Host " Change the default location that File Explorer opens to? (n/1/2/3/4) "
2025-02-13 21:08:47 +01:00
}
2025-12-26 20:36:51 +01:00
while ( $ExplSearchInput -ne 'n' -and $ExplSearchInput -ne '0' -and $ExplSearchInput -ne '1' -and $ExplSearchInput -ne '2' -and $ExplSearchInput -ne '3' -and $ExplSearchInput -ne '4' )
2025-02-13 21:08:47 +01:00
# Select correct taskbar search option based on user input
switch ( $ExplSearchInput ) {
'1' {
2025-12-26 20:36:51 +01:00
AddParameter 'ExplorerToHome'
2025-02-13 21:08:47 +01:00
}
'2' {
2025-12-26 20:36:51 +01:00
AddParameter 'ExplorerToThisPC'
2025-02-13 21:08:47 +01:00
}
'3' {
2025-12-26 20:36:51 +01:00
AddParameter 'ExplorerToDownloads'
2025-02-13 21:08:47 +01:00
}
'4' {
2025-12-26 20:36:51 +01:00
AddParameter 'ExplorerToOneDrive'
2025-02-13 21:08:47 +01:00
}
}
Write-Output " "
if ( $ ( Read-Host -Prompt " Show hidden files, folders and drives? (y/n) " ) -eq 'y' ) {
2025-12-26 20:36:51 +01:00
AddParameter 'ShowHiddenFolders'
2025-02-13 21:08:47 +01:00
}
Write-Output " "
if ( $ ( Read-Host -Prompt " Show file extensions for known file types? (y/n) " ) -eq 'y' ) {
2025-12-26 20:36:51 +01:00
AddParameter 'ShowKnownFileExt'
2025-02-13 21:08:47 +01:00
}
# Only show this option for Windows 11 users running build 22000 or later
2025-05-16 18:26:06 +02:00
if ( $WinVersion -ge 22000 ) {
2025-02-13 21:08:47 +01:00
Write-Output " "
2025-12-27 16:44:05 +01:00
if ( $ ( Read-Host -Prompt " Add all common folders (Desktop, Downloads, etc.) back to 'This PC' in File Explorer? (y/n) " ) -eq 'y' ) {
AddParameter 'HideHome'
}
Write-Output " "
2025-02-13 21:08:47 +01:00
if ( $ ( Read-Host -Prompt " Hide the Home section from the File Explorer sidepanel? (y/n) " ) -eq 'y' ) {
2025-12-26 20:36:51 +01:00
AddParameter 'HideHome'
2025-02-13 21:08:47 +01:00
}
Write-Output " "
if ( $ ( Read-Host -Prompt " Hide the Gallery section from the File Explorer sidepanel? (y/n) " ) -eq 'y' ) {
2025-12-26 20:36:51 +01:00
AddParameter 'HideGallery'
2025-02-13 21:08:47 +01:00
}
}
Write-Output " "
if ( $ ( Read-Host -Prompt " Hide duplicate removable drive entries from the File Explorer sidepanel so they only show under This PC? (y/n) " ) -eq 'y' ) {
2025-12-26 20:36:51 +01:00
AddParameter 'HideDupliDrive'
2025-02-13 21:08:47 +01:00
}
# Only show option for disabling these specific folders for Windows 10 users
2025-05-16 18:26:06 +02:00
if ( get-ciminstance -query " select caption from win32_operatingsystem where caption like '%Windows 10%' " ) {
2025-02-13 21:08:47 +01:00
Write-Output " "
if ( $ ( Read-Host -Prompt " Do you want to hide any folders from the File Explorer sidepanel? (y/n) " ) -eq 'y' ) {
Write-Output " "
if ( $ ( Read-Host -Prompt " Hide the OneDrive folder from the File Explorer sidepanel? (y/n) " ) -eq 'y' ) {
2025-12-26 20:36:51 +01:00
AddParameter 'HideOnedrive'
2025-02-13 21:08:47 +01:00
}
Write-Output " "
2025-12-26 20:36:51 +01:00
2025-02-13 21:08:47 +01:00
if ( $ ( Read-Host -Prompt " Hide the 3D objects folder from the File Explorer sidepanel? (y/n) " ) -eq 'y' ) {
2025-12-26 20:36:51 +01:00
AddParameter 'Hide3dObjects'
2025-02-13 21:08:47 +01:00
}
2025-12-26 20:36:51 +01:00
2025-02-13 21:08:47 +01:00
Write-Output " "
if ( $ ( Read-Host -Prompt " Hide the music folder from the File Explorer sidepanel? (y/n) " ) -eq 'y' ) {
2025-12-26 20:36:51 +01:00
AddParameter 'HideMusic'
2025-02-13 21:08:47 +01:00
}
}
}
}
2025-12-26 20:36:51 +01:00
# Only save settings if any changes were selected by the user
if ( $script:Params . Keys . Count -gt 1 ) {
SaveSettings
}
2025-02-13 21:08:47 +01:00
# Suppress prompt if Silent parameter was passed
if ( -not $Silent ) {
Write-Output " "
Write-Output " "
Write-Output " "
Write-Output " Press enter to confirm your choices and execute the script or press CTRL+C to quit... "
Read-Host | Out-Null
}
PrintHeader 'Custom Mode'
}
2025-12-15 23:22:29 +01:00
function ShowAppRemoval {
PrintHeader " App Removal "
2025-12-26 20:36:51 +01:00
Write-Output " > Opening app selection form... "
2025-12-15 23:22:29 +01:00
$result = ShowAppSelectionForm
if ( $result -eq [ System.Windows.Forms.DialogResult ] :: OK ) {
Write-Output " You have selected $( $script:SelectedApps . Count ) apps for removal "
2025-12-26 20:36:51 +01:00
AddParameter 'RemoveAppsCustom'
SaveSettings
2025-12-15 23:22:29 +01:00
# Suppress prompt if Silent parameter was passed
if ( -not $Silent ) {
Write-Output " "
Write-Output " "
Write-Output " Press enter to remove the selected apps or press CTRL+C to quit... "
Read-Host | Out-Null
PrintHeader " App Removal "
}
}
else {
Write-Host " Selection was cancelled, no apps have been removed " -ForegroundColor Red
Write-Output " "
}
}
2025-12-26 20:36:51 +01:00
function LoadAndShowLastUsedSettings {
2025-12-15 23:22:29 +01:00
PrintHeader 'Custom Mode'
2025-12-26 20:36:51 +01:00
try {
$savedSettings = ( Get-Content -Path $script:SavedSettingsFilePath -Raw | ConvertFrom-Json )
if ( $savedSettings . Version -and $savedSettings . Version -ne " 1.0 " ) {
2025-12-26 21:51:34 +01:00
Write-Error " LastUsedSettings.json version mismatch (expected 1.0, found $( $savedSettings . Version ) ) "
AwaitKeyToExit
2025-12-26 20:36:51 +01:00
}
if ( -not $savedSettings . Settings ) {
throw
}
# Add settings from LastUsedSettings.json to Params
Foreach ( $parameter in $savedSettings . Settings ) {
$parameterName = $parameter . Name
$value = $parameter . Value
2025-12-15 23:22:29 +01:00
2025-12-26 20:36:51 +01:00
# Skip parameters that are set to false in the config
if ( $value -eq $false ) {
continue
2025-12-15 23:22:29 +01:00
}
2025-12-26 20:36:51 +01:00
# Add parameter to Params
2025-12-15 23:22:29 +01:00
if ( -not $script:Params . ContainsKey ( $parameterName ) ) {
2025-12-26 20:36:51 +01:00
$script:Params . Add ( $parameterName , $value )
}
else {
$script:Params [ $parameterName ] = $value
2025-12-15 23:22:29 +01:00
}
}
}
2025-12-26 20:36:51 +01:00
catch {
Write-Error " Failed to load settings from LastUsedSettings.json file "
AwaitKeyToExit
2025-12-15 23:22:29 +01:00
}
2025-12-26 20:36:51 +01:00
PrintPendingChanges
2025-12-15 23:22:29 +01:00
PrintHeader 'Custom Mode'
}
2024-06-27 23:08:43 +02:00
##################################################################################################################
# #
# SCRIPT START #
# #
##################################################################################################################
# Check if winget is installed & if it is, check if the version is at least v1.4
2025-02-25 22:49:25 +01:00
if ( ( Get-AppxPackage -Name " *Microsoft.DesktopAppInstaller* " ) -and ( [ int ] ( ( ( winget -v ) -replace 'v' , '' ) . split ( '.' ) [ 0 . .1 ] -join '' ) -gt 14 ) ) {
2025-12-26 20:36:51 +01:00
$script:WingetInstalled = $true
2024-03-29 16:56:29 +01:00
}
2024-04-01 14:07:59 +02:00
else {
2025-12-26 20:36:51 +01:00
$script:WingetInstalled = $false
2024-05-05 06:20:19 -04:00
# Show warning that requires user confirmation, Suppress confirmation if Silent parameter was passed
if ( -not $Silent ) {
2025-12-26 20:36:51 +01:00
Write-Warning " Winget is not installed or outdated, this may prevent Win11Debloat from removing certain apps "
2024-05-05 06:20:19 -04:00
Write-Output " "
Write-Output " Press any key to continue anyway... "
2024-06-26 20:27:25 +02:00
$null = [ System.Console ] :: ReadKey ( )
2024-05-05 06:20:19 -04:00
}
2024-03-29 16:56:29 +01:00
}
2024-06-27 23:08:43 +02:00
# Get current Windows build version to compare against features
$WinVersion = Get-ItemPropertyValue 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' CurrentBuild
2025-08-22 17:50:47 +02:00
# Check if the machine supports Modern Standby, this is used to determine if the DisableModernStandbyNetworking option can be used
$script:ModernStandbySupported = CheckModernStandbySupport
2025-08-19 23:24:28 +05:30
2025-05-10 13:02:48 +02:00
$script:Params = $PSBoundParameters
2023-09-27 21:03:25 +02:00
2025-12-26 20:36:51 +01:00
# Add default Apps parameter when RemoveApps is requested and Apps was not explicitly provided
if ( ( -not $script:Params . ContainsKey ( " Apps " ) ) -and $script:Params . ContainsKey ( " RemoveApps " ) ) {
$script:Params . Add ( 'Apps' , 'Default' )
}
$controlParamsCount = 0
# Count how many control parameters are set, to determine if any changes were selected by the user during runtime
foreach ( $Param in $script:ControlParams ) {
2025-05-10 13:02:48 +02:00
if ( $script:Params . ContainsKey ( $Param ) ) {
2025-12-26 20:36:51 +01:00
$controlParamsCount + +
2023-09-27 21:03:25 +02:00
}
}
2024-08-17 00:08:09 +02:00
# Hide progress bars for app removal, as they block Win11Debloat's output
2025-05-10 13:02:48 +02:00
if ( -not ( $script:Params . ContainsKey ( " Verbose " ) ) ) {
2024-08-17 00:08:09 +02:00
$ProgressPreference = 'SilentlyContinue'
}
else {
2025-05-07 15:51:01 +02:00
Write-Host " Verbose mode is enabled "
Write-Output " "
Write-Output " Press any key to continue... "
$null = [ System.Console ] :: ReadKey ( )
2024-08-17 00:08:09 +02:00
$ProgressPreference = 'Continue'
}
2025-05-10 13:02:48 +02:00
if ( $script:Params . ContainsKey ( " Sysprep " ) ) {
2025-09-07 15:04:29 +02:00
$defaultUserPath = GetUserDirectory -userName " Default "
2024-08-31 22:13:59 +02:00
2024-06-27 23:08:43 +02:00
# Exit script if run in Sysprep mode on Windows 10
if ( $WinVersion -lt 22000 ) {
2025-12-26 20:36:51 +01:00
Write-Error " Win11Debloat Sysprep mode is not supported on Windows 10 "
2024-06-27 23:08:43 +02:00
AwaitKeyToExit
}
}
2025-03-05 23:39:29 +01:00
# Make sure all requirements for User mode are met, if User is specified
2025-05-10 13:02:48 +02:00
if ( $script:Params . ContainsKey ( " User " ) ) {
2025-09-07 15:04:29 +02:00
$userPath = GetUserDirectory -userName $script:Params . Item ( " User " )
2025-03-05 23:39:29 +01:00
}
2025-12-26 20:36:51 +01:00
# Remove LastUsedSettings.json file if it exists and is empty
if ( ( Test-Path $script:SavedSettingsFilePath ) -and ( [ String ] :: IsNullOrWhiteSpace ( ( Get-content $script:SavedSettingsFilePath ) ) ) ) {
Remove-Item -Path $script:SavedSettingsFilePath -recurse
2023-12-15 13:22:35 +01:00
}
2025-04-19 15:16:47 +02:00
# Only run the app selection form if the 'RunAppsListGenerator' parameter was passed to the script
if ( $RunAppConfigurator -or $RunAppsListGenerator ) {
PrintHeader " Custom Apps List Generator "
2024-03-11 23:38:19 +01:00
2024-03-29 16:56:29 +01:00
$result = ShowAppSelectionForm
2024-03-11 23:38:19 +01:00
# Show different message based on whether the app selection was saved or cancelled
2024-03-29 16:56:29 +01:00
if ( $result -ne [ System.Windows.Forms.DialogResult ] :: OK ) {
2025-04-19 15:16:47 +02:00
Write-Host " Application selection window was closed without saving. " -ForegroundColor Red
2024-03-11 23:38:19 +01:00
}
else {
2025-04-14 21:02:58 +02:00
Write-Output " Your app selection was saved to the 'CustomAppsList' file, found at: "
Write-Host " $PSScriptRoot " -ForegroundColor Yellow
2024-03-11 23:38:19 +01:00
}
2024-04-05 18:26:58 +02:00
AwaitKeyToExit
2024-03-11 23:38:19 +01:00
}
2023-08-07 00:49:41 +02:00
# Change script execution based on provided parameters or user input
2025-12-26 20:36:51 +01:00
if ( ( -not $script:Params . Count ) -or $RunDefaults -or $RunDefaultsLite -or $RunSavedSettings -or ( $controlParamsCount -eq $script:Params . Count ) ) {
2025-09-13 23:36:38 +02:00
if ( $RunDefaults -or $RunDefaultsLite ) {
2024-04-05 23:35:10 +02:00
$Mode = '1'
2020-11-07 02:57:38 +01:00
}
2025-01-09 21:33:28 +01:00
elseif ( $RunSavedSettings ) {
2025-12-26 20:36:51 +01:00
if ( -not ( Test-Path $script:SavedSettingsFilePath ) ) {
2025-01-09 21:33:28 +01:00
PrintHeader 'Custom Mode'
2025-12-26 20:36:51 +01:00
Write-Error " Unable to find LastUsedSettings.json file, no changes were made "
2025-01-09 21:33:28 +01:00
AwaitKeyToExit
}
$Mode = '4'
}
2023-05-15 16:38:11 -06:00
else {
2025-12-15 23:22:29 +01:00
$Mode = ShowScriptMenuOptions
2020-11-07 02:57:38 +01:00
}
2020-11-06 12:48:13 +01:00
2022-04-09 18:52:16 +02:00
# Add execution parameters based on the mode
2023-05-15 16:38:11 -06:00
switch ( $Mode ) {
2025-12-15 23:22:29 +01:00
# Default mode, loads defaults and app removal options
2023-05-15 16:38:11 -06:00
'1' {
2025-12-26 20:36:51 +01:00
ShowDefaultModeOptions
2021-12-15 21:45:48 +01:00
}
2022-09-08 17:20:53 +02:00
2025-12-15 23:22:29 +01:00
# Custom mode, shows all available options for user selection
2023-08-03 01:18:02 +02:00
'2' {
2025-12-15 23:22:29 +01:00
ShowCustomModeOptions
2023-12-15 13:22:35 +01:00
}
2024-03-29 16:56:29 +01:00
# App removal, remove apps based on user selection
2023-12-15 13:22:35 +01:00
'3' {
2025-12-15 23:22:29 +01:00
ShowAppRemoval
2024-03-29 16:56:29 +01:00
}
2025-12-26 20:36:51 +01:00
# Load last used options from the "LastUsedSettings.json" file
2024-03-29 16:56:29 +01:00
'4' {
2025-12-26 20:36:51 +01:00
LoadAndShowLastUsedSettings
2020-11-07 02:57:38 +01:00
}
}
2020-11-06 12:48:13 +01:00
}
2023-05-15 16:38:11 -06:00
else {
2024-03-29 16:56:29 +01:00
PrintHeader 'Custom Mode'
2020-11-06 12:48:13 +01:00
}
2025-12-26 20:36:51 +01:00
# If the number of keys in ControlParams equals the number of keys in Params then no modifications/changes were selected
2024-03-01 13:54:02 +01:00
# or added by the user, and the script can exit without making any changes.
2025-12-26 20:36:51 +01:00
if ( ( $controlParamsCount -eq $script:Params . Keys . Count ) -or ( $script:Params . Keys . Count -eq 1 -and ( $script:Params . Keys -contains 'CreateRestorePoint' -or $script:Params . Keys -contains 'Apps' ) ) ) {
2023-09-28 16:11:04 +02:00
Write-Output " The script completed without making any changes. "
2024-04-05 18:26:58 +02:00
AwaitKeyToExit
2020-10-27 23:26:39 +01:00
}
2025-02-13 21:08:47 +01:00
2025-12-15 23:22:29 +01:00
# Create a system restore point if the CreateRestorePoint parameter was passed
if ( $script:Params . ContainsKey ( " CreateRestorePoint " ) ) {
CreateSystemRestorePoint
}
2025-05-04 23:33:20 +02:00
# Execute all selected/provided parameters
2025-05-10 13:02:48 +02:00
switch ( $script:Params . Keys ) {
2025-05-04 23:33:20 +02:00
'RemoveApps' {
2025-12-26 20:36:51 +01:00
Write-Output " > Removing selected apps... "
$appsList = GenerateAppsList
if ( $appsList . Count -eq 0 ) {
Write-Host " No valid apps were selected for removal " -ForegroundColor Yellow
Write-Output " "
continue
}
Write-Output " $( $appsList . Count ) apps selected for removal "
2025-05-04 23:33:20 +02:00
RemoveApps $appsList
continue
}
'RemoveAppsCustom' {
2025-12-26 20:36:51 +01:00
Write-Output " > Removing selected apps... "
$appsList = ReadAppslistFromFile $script:CustomAppsListFilePath
if ( $appsList . Count -eq 0 ) {
Write-Host " No valid apps were selected for removal " -ForegroundColor Yellow
2025-02-13 21:08:47 +01:00
Write-Output " "
continue
}
2025-12-26 20:36:51 +01:00
Write-Output " $( $appsList . Count ) apps selected for removal "
2025-05-04 23:33:20 +02:00
RemoveApps $appsList
continue
}
'RemoveCommApps' {
$appsList = 'Microsoft.windowscommunicationsapps' , 'Microsoft.People'
2025-05-10 16:42:03 +02:00
Write-Output " > Removing Mail, Calendar and People apps... "
2025-05-04 23:33:20 +02:00
RemoveApps $appsList
continue
}
'RemoveW11Outlook' {
$appsList = 'Microsoft.OutlookForWindows'
Write-Output " > Removing new Outlook for Windows app... "
RemoveApps $appsList
continue
}
'RemoveGamingApps' {
$appsList = 'Microsoft.GamingApp' , 'Microsoft.XboxGameOverlay' , 'Microsoft.XboxGamingOverlay'
Write-Output " > Removing gaming related apps... "
RemoveApps $appsList
continue
2023-09-28 16:11:04 +02:00
}
2025-05-04 23:33:20 +02:00
'RemoveHPApps' {
$appsList = 'AD2F1837.HPAIExperienceCenter' , 'AD2F1837.HPJumpStarts' , 'AD2F1837.HPPCHardwareDiagnosticsWindows' , 'AD2F1837.HPPowerManager' , 'AD2F1837.HPPrivacySettings' , 'AD2F1837.HPSupportAssistant' , 'AD2F1837.HPSureShieldAI' , 'AD2F1837.HPSystemInformation' , 'AD2F1837.HPQuickDrop' , 'AD2F1837.HPWorkWell' , 'AD2F1837.myHP' , 'AD2F1837.HPDesktopSupportUtilities' , 'AD2F1837.HPQuickTouch' , 'AD2F1837.HPEasyClean' , 'AD2F1837.HPConnectedMusic' , 'AD2F1837.HPFileViewer' , 'AD2F1837.HPRegistration' , 'AD2F1837.HPWelcome' , 'AD2F1837.HPConnectedPhotopoweredbySnapfish' , 'AD2F1837.HPPrinterControl'
Write-Output " > Removing HP apps... "
RemoveApps $appsList
continue
}
" ForceRemoveEdge " {
ForceRemoveEdge
continue
}
'DisableDVR' {
RegImport " > Disabling Xbox game/screen recording... " " Disable_DVR.reg "
continue
}
2025-11-29 17:15:12 +01:00
'DisableGameBarIntegration' {
2025-11-30 01:30:34 +01:00
RegImport " > Disabling Game Bar integration... " " Disable_Game_Bar_Integration.reg "
2025-11-14 23:50:39 +01:00
continue
}
2025-05-04 23:33:20 +02:00
'DisableTelemetry' {
RegImport " > Disabling telemetry, diagnostic data, activity history, app-launch tracking and targeted ads... " " Disable_Telemetry.reg "
continue
}
{ $_ -in " DisableSuggestions " , " DisableWindowsSuggestions " } {
RegImport " > Disabling tips, tricks, suggestions and ads across Windows... " " Disable_Windows_Suggestions.reg "
continue
}
2025-08-16 01:36:00 +02:00
'DisableEdgeAds' {
2025-09-12 00:08:15 +02:00
RegImport " > Disabling ads, suggestions and the MSN news feed in Microsoft Edge... " " Disable_Edge_Ads_And_Suggestions.reg "
2025-08-16 01:36:00 +02:00
continue
}
2025-05-04 23:33:20 +02:00
{ $_ -in " DisableLockscrTips " , " DisableLockscreenTips " } {
RegImport " > Disabling tips & tricks on the lockscreen... " " Disable_Lockscreen_Tips.reg "
continue
}
2025-05-20 21:56:04 +02:00
'DisableDesktopSpotlight' {
RegImport " > Disabling the 'Windows Spotlight' desktop background option... " " Disable_Desktop_Spotlight.reg "
continue
}
2025-06-11 22:04:17 +02:00
'DisableSettings365Ads' {
RegImport " > Disabling Microsoft 365 ads in Settings Home... " " Disable_Settings_365_Ads.reg "
continue
}
2025-05-20 21:56:04 +02:00
'DisableSettingsHome' {
RegImport " > Disabling the Settings Home page... " " Disable_Settings_Home.reg "
continue
}
2025-05-04 23:33:20 +02:00
{ $_ -in " DisableBingSearches " , " DisableBing " } {
2025-06-11 12:16:55 +02:00
RegImport " > Disabling Bing web search, Bing AI and Cortana from Windows search... " " Disable_Bing_Cortana_In_Search.reg "
2025-12-26 20:36:51 +01:00
2025-06-11 12:16:55 +02:00
# Also remove the app package for Bing search
2025-05-04 23:33:20 +02:00
$appsList = 'Microsoft.BingSearch'
RemoveApps $appsList
continue
}
'DisableCopilot' {
2025-08-01 21:21:38 +02:00
RegImport " > Disabling Microsoft Copilot... " " Disable_Copilot.reg "
2020-10-27 23:26:39 +01:00
2025-06-11 12:16:55 +02:00
# Also remove the app package for Copilot
2025-05-04 23:33:20 +02:00
$appsList = 'Microsoft.Copilot'
RemoveApps $appsList
continue
}
'DisableRecall' {
2025-12-26 20:36:51 +01:00
if ( $WinVersion -lt 22000 ) {
Write-Output " > Disabling Windows Recall... "
Write-Host " Feature is not available on Windows 10 " -ForegroundColor Yellow
Write-Output " "
continue
}
2025-09-27 14:19:41 +02:00
RegImport " > Disabling Windows Recall... " " Disable_AI_Recall.reg "
2025-05-04 23:33:20 +02:00
continue
}
2025-09-17 23:33:52 +02:00
'DisableClickToDo' {
2025-12-26 20:36:51 +01:00
if ( $WinVersion -lt 22000 ) {
Write-Output " > Disabling Click to Do... "
Write-Host " Feature is not available on Windows 10 " -ForegroundColor Yellow
Write-Output " "
continue
}
2025-09-27 14:19:41 +02:00
RegImport " > Disabling Click to Do... " " Disable_Click_to_Do.reg "
2025-09-17 23:33:52 +02:00
continue
}
2025-08-16 01:36:00 +02:00
'DisableEdgeAI' {
RegImport " > Disabling AI features in Microsoft Edge... " " Disable_Edge_AI_Features.reg "
continue
}
2025-08-01 21:21:38 +02:00
'DisablePaintAI' {
RegImport " > Disabling AI features in Paint... " " Disable_Paint_AI_Features.reg "
continue
}
'DisableNotepadAI' {
RegImport " > Disabling AI features in Notepad... " " Disable_Notepad_AI_Features.reg "
continue
}
2025-05-04 23:33:20 +02:00
'RevertContextMenu' {
RegImport " > Restoring the old Windows 10 style context menu... " " Disable_Show_More_Options_Context_Menu.reg "
continue
}
'DisableMouseAcceleration' {
RegImport " > Turning off Enhanced Pointer Precision... " " Disable_Enhance_Pointer_Precision.reg "
continue
}
'DisableStickyKeys' {
RegImport " > Disabling the Sticky Keys keyboard shortcut... " " Disable_Sticky_Keys_Shortcut.reg "
continue
}
'DisableFastStartup' {
RegImport " > Disabling Fast Start-up... " " Disable_Fast_Startup.reg "
continue
}
2025-08-19 23:24:28 +05:30
'DisableModernStandbyNetworking' {
2025-12-26 20:36:51 +01:00
if ( -not $script:ModernStandbySupported ) {
Write-Output " > Disabling network connectivity during Modern Standby... "
Write-Host " Device does not support modern standby " -ForegroundColor Yellow
Write-Output " "
continue
}
2025-08-19 23:24:28 +05:30
RegImport " > Disabling network connectivity during Modern Standby... " " Disable_Modern_Standby_Networking.reg "
continue
}
2025-05-04 23:33:20 +02:00
'ClearStart' {
Write-Output " > Removing all pinned apps from the start menu for user $( GetUserName ) ... "
ReplaceStartMenu
Write-Output " "
continue
}
2025-05-19 00:01:49 +02:00
'ReplaceStart' {
Write-Output " > Replacing the start menu for user $( GetUserName ) ... "
ReplaceStartMenu $script:Params . Item ( " ReplaceStart " )
Write-Output " "
continue
}
2025-05-04 23:33:20 +02:00
'ClearStartAllUsers' {
ReplaceStartMenuForAllUsers
continue
}
2025-05-19 00:01:49 +02:00
'ReplaceStartAllUsers' {
ReplaceStartMenuForAllUsers $script:Params . Item ( " ReplaceStartAllUsers " )
continue
}
2025-05-04 23:33:20 +02:00
'DisableStartRecommended' {
2025-08-01 21:21:38 +02:00
RegImport " > Disabling the start menu recommended section... " " Disable_Start_Recommended.reg "
2025-05-04 23:33:20 +02:00
continue
}
2025-06-11 22:04:17 +02:00
'DisableStartPhoneLink' {
RegImport " > Disabling the Phone Link mobile devices integration in the start menu... " " Disable_Phone_Link_In_Start.reg "
continue
}
2025-06-12 21:50:57 +02:00
'EnableDarkMode' {
RegImport " > Enabling dark mode for system and apps... " " Enable_Dark_Mode.reg "
continue
}
'DisableTransparency' {
RegImport " > Disabling transparency effects... " " Disable_Transparency.reg "
continue
}
'DisableAnimations' {
RegImport " > Disabling animations and visual effects... " " Disable_Animations.reg "
continue
}
2025-05-04 23:33:20 +02:00
'TaskbarAlignLeft' {
RegImport " > Aligning taskbar buttons to the left... " " Align_Taskbar_Left.reg "
continue
}
2025-09-27 14:34:01 +02:00
'CombineTaskbarAlways' {
2025-10-06 23:42:02 +02:00
RegImport " > Setting the taskbar on the main display to always combine buttons and hide labels... " " Combine_Taskbar_Always.reg "
2025-09-27 14:34:01 +02:00
continue
}
'CombineTaskbarWhenFull' {
2025-10-06 23:42:02 +02:00
RegImport " > Setting the taskbar on the main display to only combine buttons and hide labels when the taskbar is full... " " Combine_Taskbar_When_Full.reg "
2025-09-27 14:34:01 +02:00
continue
}
'CombineTaskbarNever' {
2025-10-06 23:42:02 +02:00
RegImport " > Setting the taskbar on the main display to never combine buttons or hide labels... " " Combine_Taskbar_Never.reg "
2025-09-27 14:34:01 +02:00
continue
}
2025-10-06 23:33:04 +02:00
'CombineMMTaskbarAlways' {
2025-10-06 23:42:02 +02:00
RegImport " > Setting the taskbar on secondary displays to always combine buttons and hide labels... " " Combine_MMTaskbar_Always.reg "
2025-10-06 23:33:04 +02:00
continue
}
'CombineMMTaskbarWhenFull' {
2025-10-06 23:42:02 +02:00
RegImport " > Setting the taskbar on secondary displays to only combine buttons and hide labels when the taskbar is full... " " Combine_MMTaskbar_When_Full.reg "
2025-10-06 23:33:04 +02:00
continue
}
'CombineMMTaskbarNever' {
2025-10-06 23:42:02 +02:00
RegImport " > Setting the taskbar on secondary displays to never combine buttons or hide labels... " " Combine_MMTaskbar_Never.reg "
2025-10-06 23:33:04 +02:00
continue
}
'MMTaskbarModeAll' {
2025-10-06 23:42:02 +02:00
RegImport " > Setting the taskbar to only show app icons on main taskbar... " " MMTaskbarMode_All.reg "
2025-10-06 23:33:04 +02:00
continue
}
'MMTaskbarModeMainActive' {
2025-10-06 23:42:02 +02:00
RegImport " > Setting the taskbar to show app icons on all taskbars... " " MMTaskbarMode_Main_Active.reg "
2025-10-06 23:33:04 +02:00
continue
}
'MMTaskbarModeActive' {
2025-10-06 23:42:02 +02:00
RegImport " > Setting the taskbar to only show app icons on the taskbar where the window is open... " " MMTaskbarMode_Active.reg "
2025-10-06 23:33:04 +02:00
continue
}
2025-05-04 23:33:20 +02:00
'HideSearchTb' {
RegImport " > Hiding the search icon from the taskbar... " " Hide_Search_Taskbar.reg "
continue
}
'ShowSearchIconTb' {
RegImport " > Changing taskbar search to icon only... " " Show_Search_Icon.reg "
continue
}
'ShowSearchLabelTb' {
RegImport " > Changing taskbar search to icon with label... " " Show_Search_Icon_And_Label.reg "
continue
}
'ShowSearchBoxTb' {
RegImport " > Changing taskbar search to search box... " " Show_Search_Box.reg "
continue
}
'HideTaskview' {
RegImport " > Hiding the taskview button from the taskbar... " " Hide_Taskview_Taskbar.reg "
continue
}
{ $_ -in " HideWidgets " , " DisableWidgets " } {
2025-09-07 19:13:51 +02:00
RegImport " > Disabling widgets on the taskbar & lockscreen... " " Disable_Widgets_Service.reg "
2025-05-21 12:04:58 +02:00
# Also remove the app package for Widgets
$appsList = 'Microsoft.StartExperiencesApp'
RemoveApps $appsList
2025-05-04 23:33:20 +02:00
continue
}
{ $_ -in " HideChat " , " DisableChat " } {
2025-12-26 20:36:51 +01:00
if ( $WinVersion -ge 22000 ) {
Write-Output " > Hiding the chat icon from the taskbar... "
Write-Host " Feature is not available on Windows 11 " -ForegroundColor Yellow
Write-Output " "
continue
}
2025-05-04 23:33:20 +02:00
RegImport " > Hiding the chat icon from the taskbar... " " Disable_Chat_Taskbar.reg "
continue
}
'EnableEndTask' {
RegImport " > Enabling the 'End Task' option in the taskbar right click menu... " " Enable_End_Task.reg "
continue
}
2025-07-30 15:30:51 -04:00
'EnableLastActiveClick' {
RegImport " > Enabling the 'Last Active Click' behavior in the taskbar app area... " " Enable_Last_Active_Click.reg "
continue
}
2025-05-04 23:33:20 +02:00
'ExplorerToHome' {
RegImport " > Changing the default location that File Explorer opens to ` Home ` ... " " Launch_File_Explorer_To_Home.reg "
continue
}
'ExplorerToThisPC' {
RegImport " > Changing the default location that File Explorer opens to `T his PC ` ... " " Launch_File_Explorer_To_This_PC.reg "
continue
}
'ExplorerToDownloads' {
RegImport " > Changing the default location that File Explorer opens to ` Downloads ` ... " " Launch_File_Explorer_To_Downloads.reg "
continue
}
'ExplorerToOneDrive' {
RegImport " > Changing the default location that File Explorer opens to ` OneDrive ` ... " " Launch_File_Explorer_To_OneDrive.reg "
continue
}
'ShowHiddenFolders' {
RegImport " > Unhiding hidden files, folders and drives... " " Show_Hidden_Folders.reg "
continue
}
'ShowKnownFileExt' {
RegImport " > Enabling file extensions for known file types... " " Show_Extensions_For_Known_File_Types.reg "
continue
}
2025-12-27 16:44:05 +01:00
'AddFoldersToThisPC' {
RegImport " > Adding all common folders (Desktop, Downloads, etc.) back to This PC in File Explorer... " " Add_All_Folders_Under_This_PC.reg "
continue
}
2025-05-04 23:33:20 +02:00
'HideHome' {
RegImport " > Hiding the home section from the File Explorer navigation pane... " " Hide_Home_from_Explorer.reg "
continue
}
'HideGallery' {
RegImport " > Hiding the gallery section from the File Explorer navigation pane... " " Hide_Gallery_from_Explorer.reg "
continue
}
'HideDupliDrive' {
RegImport " > Hiding duplicate removable drive entries from the File Explorer navigation pane... " " Hide_duplicate_removable_drives_from_navigation_pane_of_File_Explorer.reg "
continue
}
{ $_ -in " HideOnedrive " , " DisableOnedrive " } {
RegImport " > Hiding the OneDrive folder from the File Explorer navigation pane... " " Hide_Onedrive_Folder.reg "
continue
}
{ $_ -in " Hide3dObjects " , " Disable3dObjects " } {
2025-12-26 20:36:51 +01:00
if ( $WinVersion -ge 22000 ) {
Write-Output " > Hiding the 3D objects folder from the File Explorer navigation pane... "
Write-Host " Feature is not available on Windows 11 " -ForegroundColor Yellow
Write-Output " "
continue
}
2025-05-04 23:33:20 +02:00
RegImport " > Hiding the 3D objects folder from the File Explorer navigation pane... " " Hide_3D_Objects_Folder.reg "
continue
}
{ $_ -in " HideMusic " , " DisableMusic " } {
RegImport " > Hiding the music folder from the File Explorer navigation pane... " " Hide_Music_folder.reg "
continue
}
{ $_ -in " HideIncludeInLibrary " , " DisableIncludeInLibrary " } {
RegImport " > Hiding 'Include in library' in the context menu... " " Disable_Include_in_library_from_context_menu.reg "
continue
}
{ $_ -in " HideGiveAccessTo " , " DisableGiveAccessTo " } {
RegImport " > Hiding 'Give access to' in the context menu... " " Disable_Give_access_to_context_menu.reg "
continue
}
{ $_ -in " HideShare " , " DisableShare " } {
RegImport " > Hiding 'Share' in the context menu... " " Disable_Share_from_context_menu.reg "
continue
}
}
2023-09-27 21:03:25 +02:00
2025-05-04 23:33:20 +02:00
RestartExplorer
2023-09-27 21:03:25 +02:00
2025-05-04 23:33:20 +02:00
Write-Output " "
Write-Output " "
Write-Output " "
Write-Output " Script completed! Please check above for any errors. "
AwaitKeyToExit