0% found this document useful (0 votes)
14 views49 pages

Win11 Debloat App Selection Tool

The document outlines a PowerShell script designed for Windows 11 that allows users to select and remove unwanted applications from their system. It includes a graphical user interface for app selection, error handling for restricted execution environments, and functions to remove apps both for current users and from the OS image. The script also contains specific handling for Microsoft Edge and OneDrive removal, including a force uninstall option for Edge if necessary.

Uploaded by

Thjeu Kj
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views49 pages

Win11 Debloat App Selection Tool

The document outlines a PowerShell script designed for Windows 11 that allows users to select and remove unwanted applications from their system. It includes a graphical user interface for app selection, error handling for restricted execution environments, and functions to remove apps both for current users and from the OS image. The script also contains specific handling for Microsoft Edge and OneDrive removal, including a force uninstall option for Edge if necessary.

Uploaded by

Thjeu Kj
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

#Requires -RunAsAdministrator

[
[switch]$HideGallery,
[switch]$DisableOnedrive, [switch]$HideOnedrive,
[switch]$Disable3dObjects, [switch]$Hide3dObjects,
[switch]$DisableMusic, [switch]$HideMusic,
[switch]$DisableIncludeInLibrary, [switch]$HideIncludeInLibrary,
[switch]$DisableGiveAccessTo, [switch]$HideGiveAccessTo,
[switch]$DisableShare, [switch]$HideShare
)

# Show error if current powershell environment does not have LanguageMode set to FullLanguage
if ($[Link] -ne "FullLanguage") {
Write-Host "Error: Win11Debloat is unable to run on your system, powershell execution is restricted
by security policies" -ForegroundColor Red
Write-Output ""
Write-Output "Press enter to exit..."
Read-Host | Out-Null
Exit
}

# Shows application selection form that allows the user to select what apps they want to remove or keep
function ShowAppSelectionForm {
[[Link]]::loadwithpartialname("[Link]") | Out-Null
[[Link]]::loadwithpartialname("[Link]") | Out-Null

# Initialise form objects


$form = New-Object [Link]
$label = New-Object [Link]
$button1 = New-Object [Link]
$button2 = New-Object [Link]
$selectionBox = New-Object [Link]
$loadingLabel = New-Object [Link]
$onlyInstalledCheckBox = New-Object [Link]
$checkUncheckCheckBox = New-Object [Link]
$initialFormWindowState = New-Object [Link]

$global:selectionBoxIndex = -1

# saveButton eventHandler
$handler_saveButton_Click=
{
$global:SelectedApps = $[Link]

# Create file that stores selected apps if it doesn't exist


if (!(Test-Path "$PSScriptRoot/CustomAppsList")) {
$null = New-Item "$PSScriptRoot/CustomAppsList"
}

Set-Content -Path "$PSScriptRoot/CustomAppsList" -Value $global:SelectedApps

$[Link]()
}

# cancelButton eventHandler
$handler_cancelButton_Click=
{
$[Link]()
}

$selectionBox_SelectedIndexChanged=
{
$global:selectionBoxIndex = $[Link]
}

$selectionBox_MouseDown=
{
if ($_.Button -eq [[Link]]::Left) {
if([[Link]]::ModifierKeys -eq [[Link]]::Shift) {
if($global:selectionBoxIndex -ne -1) {
$topIndex = $global:selectionBoxIndex

if ($[Link] -gt $topIndex) {


for(($i = ($topIndex)); $i -le $[Link]; $i++){
$[Link]($i, $[Link]($topIndex))
}
}
elseif ($topIndex -gt $[Link]) {
for(($i = ($[Link])); $i -le $topIndex; $i++){
$[Link]($i, $[Link]($topIndex))
}
}
}
}
elseif($global:selectionBoxIndex -ne $[Link]) {
$[Link]($[Link], -not
$[Link]($[Link]))
}
}
}

$check_All=
{
for(($i = 0); $i -lt $[Link]; $i++){
$[Link]($i, $[Link])
}
}

$load_Apps=
{
# Correct the initial state of the form to prevent the .Net maximized form issue
$[Link] = $initialFormWindowState

# Reset state to default before loading appslist again


$global:selectionBoxIndex = -1
$[Link] = $False

# Show loading indicator


$[Link] = $true
$[Link]()

# Clear selectionBox before adding any new items


$[Link]()

# Set filePath where Appslist can be found


$appsFile = "$PSScriptRoot/[Link]"
$listOfApps = ""
if ($[Link] -and ($global:wingetInstalled -eq $true)) {
# 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
[[Link]]::Show('Unable to load list of installed apps via winget, some
apps may not be displayed in the list.','Error','Ok','Error')
}
else {
# Add output of job (list of apps) to $listOfApps
$listOfApps = Receive-Job -Job $job
}
}

# Go through appslist and add items one by one to the selectionBox


Foreach ($app in (Get-Content -Path $appsFile | Where-Object { $_ -notmatch '^\s*$' } )) {
$appChecked = $true

# Remove first # if it exists and set AppChecked to false


if ($[Link]('#')) {
$app = $[Link]("#")
$appChecked = $false
}
# Remove any comments from the Appname
if (-not ($[Link]('#') -eq -1)) {
$app = $[Link](0, $[Link]('#'))
}
# Remove any remaining spaces from the Appname
if (-not ($[Link](' ') -eq -1)) {
$app = $[Link](0, $[Link](' '))
}

$appString = $[Link]('*')

# Make sure appString is not empty


if ($[Link] -gt 0) {
if ($[Link]) {
# onlyInstalledCheckBox is checked, check if app is installed before adding it to
selectionBox
if (-not ($listOfApps -like ("*$appString*")) -and -not (Get-AppxPackage -Name $app)) {
# App is not installed, continue with next item
continue
}
if (($appString -eq "[Link]") -and -not ($listOfApps -like "* [Link] *")) {
# App is not installed, continue with next item
continue
}
}

# Add the app to the selectionBox and set it's checked status
$[Link]($appString, $appChecked) | Out-Null
}
}

# Hide loading indicator


$[Link] = $False
# Sort selectionBox alphabetically
$[Link] = $True
}

$[Link] = "Win11Debloat Application Selection"


$[Link] = "appSelectionForm"
$[Link] = 0
$[Link] = New-Object [Link](400,502)
$[Link] = 'FixedDialog'
$[Link] = $False

$[Link] = 4
$[Link] = "saveButton"
$[Link] = [[Link]]::OK
$[Link] = $True
$[Link] = "Confirm"
$[Link] = New-Object [Link](27,472)
$[Link] = New-Object [Link](75,23)
$[Link] = 0
$button1.add_Click($handler_saveButton_Click)

$[Link]($button1)

$[Link] = 5
$[Link] = "cancelButton"
$[Link] = [[Link]]::Cancel
$[Link] = $True
$[Link] = "Cancel"
$[Link] = New-Object [Link](129,472)
$[Link] = New-Object [Link](75,23)
$[Link] = 0
$button2.add_Click($handler_cancelButton_Click)

$[Link]($button2)

$[Link] = New-Object [Link](13,5)


$[Link] = New-Object [Link](400,14)
$[Link] = 'Microsoft Sans Serif,8'
$[Link] = 'Check apps that you wish to remove, uncheck apps that you wish to keep'

$[Link]($label)

$[Link] = New-Object [Link](16,46)


$[Link] = New-Object [Link](300,418)
$[Link] = 'Loading apps...'
$[Link] = "White"
$[Link] = $false

$[Link]($loadingLabel)

$[Link] = 6
$[Link] = New-Object [Link](230,474)
$[Link] = New-Object [Link](150,20)
$[Link] = 'Only show installed apps'
$onlyInstalledCheckBox.add_CheckedChanged($load_Apps)

$[Link]($onlyInstalledCheckBox)

$[Link] = 7
$[Link] = New-Object [Link](16,22)
$[Link] = New-Object [Link](150,20)
$[Link] = 'Check/Uncheck all'
$checkUncheckCheckBox.add_CheckedChanged($check_All)

$[Link]($checkUncheckCheckBox)

$[Link] = $True
$[Link] = 0
$[Link] = "selectionBox"
$[Link] = New-Object [Link](13,43)
$[Link] = New-Object [Link](374,424)
$[Link] = 3
$selectionBox.add_SelectedIndexChanged($selectionBox_SelectedIndexChanged)
$selectionBox.add_Click($selectionBox_MouseDown)

$[Link]($selectionBox)

# Save the initial state of the form


$initialFormWindowState = $[Link]

# Load apps into selectionBox


$form.add_Load($load_Apps)

# Focus selectionBox when form opens


$form.Add_Shown({$[Link](); $[Link]()})

# Show the Form


return $[Link]()
}
# Reads list of apps from file and removes them for all user accounts and from the OS image.
function RemoveAppsFromFile {
param (
$appsFilePath
)

$appsList = @()

Write-Output "> Removing default selection of apps..."

# Get list of apps from file at the path provided, and remove them one by one
Foreach ($app in (Get-Content -Path $appsFilePath | Where-Object { $_ -notmatch '^#.*' -and $_ -
notmatch '^\s*$' } )) {
# Remove any spaces before and after the Appname
$app = $[Link]()

# Remove any comments from the Appname


if (-not ($[Link]('#') -eq -1)) {
$app = $[Link](0, $[Link]('#'))
}
# Remove any remaining spaces from the Appname
if (-not ($[Link](' ') -eq -1)) {
$app = $[Link](0, $[Link](' '))
}

$appString = $[Link]('*')
$appsList += $appString
}
RemoveApps $appsList
}

# Removes apps specified during function call from all user accounts and from the OS image.
function RemoveApps {
param (
$appslist
)

Foreach ($app in $appsList) {


Write-Output "Attempting to remove $app..."

if (($app -eq "[Link]") -or ($app -eq "[Link]")) {


# Use winget to remove OneDrive and Edge
if ($global:wingetInstalled -eq $false) {
Write-Host "WinGet is either not installed or is outdated, so $app could not be removed" -
ForegroundColor Red
}
else {
# Uninstall app via winget
Strip-Progress -ScriptBlock { winget uninstall --accept-source-agreements --disable-
interactivity --id $app } | Tee-Object -Variable wingetOutput

If (($app -eq "[Link]") -and (Select-String -InputObject $wingetOutput -Pattern "93"))


{
Write-Host "Error: Unable to uninstall Microsoft Edge via Winget" -ForegroundColor Red
Write-Output ""

if ($( Read-Host -Prompt "Would you like to forcefully uninstall Edge? NOT
RECOMMENDED! (y/n)" ) -eq 'y') {
Write-Output ""
ForceRemoveEdge
}
}
}
}
else {
# Use Remove-AppxPackage to remove all other apps
$app = '*' + $app + '*'

# Remove installed app for all existing users


if ($WinVersion -ge 22000){
# Windows 11 build 22000 or later
Get-AppxPackage -Name $app -AllUsers | Remove-AppxPackage -AllUsers
}
else {
# Windows 10
Get-AppxPackage -Name $app -PackageTypeFilter Main, Bundle, Resource -AllUsers |
Remove-AppxPackage -AllUsers
}

# Remove provisioned app from OS image, so the app won't be installed for any new users
Get-AppxProvisionedPackage -Online | Where-Object { $_.PackageName -like $app } | ForEach-
Object { Remove-ProvisionedAppxPackage -Online -AllUsers -PackageName $_.PackageName }
}
}
}

function ForceRemoveEdge {
# Based on work from loadstring1 & ave9858
Write-Output "> Forcefully uninstalling Microsoft Edge..."

$regView = [[Link]]::Registry32
$hklm =
[[Link]]::OpenBaseKey([[Link]]::LocalMachine,
$regView)
$[Link]('SOFTWARE\Microsoft\EdgeUpdateDev').SetValue('AllowUninstall', '')

# Create stub (Creating this somehow allows uninstalling edge)


$edgeStub = "$env:SystemRoot\SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe"
New-Item $edgeStub -ItemType Directory | Out-Null
New-Item "$edgeStub\[Link]" | Out-Null

# Remove edge
$uninstallRegKey = $[Link]('SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\
Microsoft Edge')
if($uninstallRegKey -ne $null) {
Write-Output "Running uninstaller..."
$uninstallString = $[Link]('UninstallString') + ' --force-uninstall'
Start-Process [Link] "/c $uninstallString" -WindowStyle Hidden -Wait

Write-Output "Removing leftover files..."

$appdata = $([Environment]::GetFolderPath('ApplicationData'))

$edgePaths = @(
"$env:ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft [Link]",
"$env:APPDATA\Microsoft\Internet Explorer\Quick Launch\Microsoft [Link]",
"$env:APPDATA\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Microsoft
[Link]",
"$env:PUBLIC\Desktop\Microsoft [Link]",
"$env:USERPROFILE\Desktop\Microsoft [Link]",
"$appdata\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Tombstones\
Microsoft [Link]",
"$appdata\Microsoft\Internet Explorer\Quick Launch\Microsoft [Link]",
"$edgeStub"
)

foreach ($path in $edgePaths){


if (Test-Path -Path $path) {
Remove-Item -Path $path -Force -Recurse -ErrorAction SilentlyContinue
Write-Host " Removed $path" -ForegroundColor DarkGray
}
}

Write-Output "Cleaning up registry..."

# Remove ms edge from autostart


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
}

Write-Output ""
}

# Execute provided command and strips progress spinners/bars from console output
function Strip-Progress {
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 [[Link]]) {
"ERROR: $($_.[Link])"
} else {
$line = $_ -replace $progressPattern, '' -replace $sizePattern, ''
if (-not ([string]::IsNullOrWhiteSpace($line)) -and -not ($[Link](' '))) {
$line
}
}
}
}

# Import & execute regfile


function RegImport {
param (
$message,
$path
)

Write-Output $message

if (!$global:[Link]("Sysprep")) {
reg import "$PSScriptRoot\Regfiles\$path"
}
else {
reg load "HKU\Default" "C:\Users\Default\[Link]" | Out-Null
reg import "$PSScriptRoot\Regfiles\Sysprep\$path"
reg unload "HKU\Default" | Out-Null
}

Write-Output ""
}

# Restart the Windows Explorer process


function RestartExplorer {
Write-Output "> Restarting Windows Explorer process to apply all changes... (This may cause some
flickering)"
# Only restart if the powershell process matches the OS architecture
# Restarting explorer from a 32bit Powershell window will fail on a 64bit OS
if ([Environment]::Is64BitProcess -eq [Environment]::Is64BitOperatingSystem)
{
Stop-Process -processName: Explorer -Force
}
else {
Write-Warning "Unable to restart Windows Explorer process, please manually restart your PC to
apply all changes."
}
}

# Clear all pinned apps from the start menu.


# Credit: [Link]
function ClearStartMenu {
param (
$message,
$applyToAllUsers = $True
)

Write-Output $message

# Path to start menu template


$startmenuTemplate = "$PSScriptRoot/Start/[Link]"

# Check if template bin file exists, return early if it doesn't


if (-not (Test-Path $startmenuTemplate)) {
Write-Host "Error: Unable to clear start menu, [Link] file missing from script folder" -
ForegroundColor Red
Write-Output ""
return
}

if ($applyToAllUsers) {
# Remove startmenu pinned apps for all users
# Get all user profile folders
$usersStartMenu = get-childitem -path "C:\Users\*\AppData\Local\Packages\
[Link].StartMenuExperienceHost_cw5n1h2txyewy\LocalState"

# Copy Start menu to all users folders


ForEach ($startmenu in $usersStartMenu) {
$startmenuBinFile = $[Link] + "\[Link]"
$backupBinFile = $startmenuBinFile + ".bak"

# Check if bin file exists


if (Test-Path $startmenuBinFile) {
# Backup current startmenu file
Move-Item -Path $startmenuBinFile -Destination $backupBinFile -Force

# Copy template file


Copy-Item -Path $startmenuTemplate -Destination $startmenu -Force

Write-Output "Replaced start menu for user $($[Link]("\")[2])"


}
else {
# Bin file doesn't exist, indicating the user is not running the correct version of Windows. Exit
function
Write-Host "Error: Unable to clear start menu, [Link] file could not found for user"
$[Link]("\")[2] -ForegroundColor Red
Write-Output ""
return
}
}

# Also apply start menu template to the default profile

# Path to default profile


$defaultProfile = "C:\Users\default\AppData\Local\Packages\
[Link].StartMenuExperienceHost_cw5n1h2txyewy\LocalState"

# Create folder if it doesn't exist


if (-not(Test-Path $defaultProfile)) {
new-item $defaultProfile -ItemType Directory -Force | Out-Null
Write-Output "Created LocalState folder for default user"
}

# Copy template to default profile


Copy-Item -Path $startmenuTemplate -Destination $defaultProfile -Force
Write-Output "Copied start menu template to default user folder"
Write-Output ""
}
else {
# Only remove startmenu pinned apps for current logged in user
$startmenuBinFile = "C:\Users\$([Environment]::UserName)\AppData\Local\Packages\
[Link].StartMenuExperienceHost_cw5n1h2txyewy\LocalState\[Link]"
$backupBinFile = $startmenuBinFile + ".bak"

# Check if bin file exists


if (Test-Path $startmenuBinFile) {
# Backup current startmenu file
Move-Item -Path $startmenuBinFile -Destination $backupBinFile -Force
# Copy template file
Copy-Item -Path $startmenuTemplate -Destination $startmenuBinFile -Force

Write-Output "Replaced start menu for user $([Environment]::UserName)"


Write-Output ""
}
else {
# Bin file doesn't exist, indicating the user is not running the correct version of Windows. Exit
function
Write-Host "Error: Unable to clear start menu, [Link] file could not found for user $
([Environment]::UserName)" -ForegroundColor Red
Write-Output ""
return
}
}
}

# Add parameter to script and write to file


function AddParameter {
param (
$parameterName,
$message
)

# Add key if it doesn't already exist


if (-not $global:[Link]($parameterName)) {
$global:[Link]($parameterName, $true)
}
# Create or clear file that stores last used settings
if (!(Test-Path "$PSScriptRoot/SavedSettings")) {
$null = New-Item "$PSScriptRoot/SavedSettings"
}
elseif ($global:FirstSelection) {
$null = Clear-Content "$PSScriptRoot/SavedSettings"
}

$global:FirstSelection = $false

# Create entry and add it to the file


$entry = "$parameterName#- $message"
Add-Content -Path "$PSScriptRoot/SavedSettings" -Value $entry
}

function PrintHeader {
param (
$title
)

$fullTitle = " Win11Debloat Script - $title"

if($global:[Link]("Sysprep")) {
$fullTitle = "$fullTitle (Sysprep mode)"
}

Clear-Host
Write-Output "-------------------------------------------------------------------------------------------"
Write-Output $fullTitle
Write-Output "-------------------------------------------------------------------------------------------"
}

function PrintFromFile {
param (
$path
)

Clear-Host

# Get & print script menu from file


Foreach ($line in (Get-Content -Path $path )) {
Write-Output $line
}
}

function AwaitKeyToExit {
# Suppress prompt if Silent parameter was passed
if (-not $Silent) {
Write-Output ""
Write-Output "Press any key to exit..."
$null = [[Link]]::ReadKey()
}
}
#####################################################################################
#############################
# #
# SCRIPT START #
# #
#####################################################################################
#############################

# Check if winget is installed & if it is, check if the version is at least v1.4
if ((Get-AppxPackage -Name "*[Link]*") -and ((winget -v) -replace 'v','' -gt
1.4)) {
$global:wingetInstalled = $true
}
else {
$global:wingetInstalled = $false

# Show warning that requires user confirmation, Suppress confirmation if Silent parameter was passed
if (-not $Silent) {
Write-Warning "Winget is not installed or outdated. This may prevent Win11Debloat from removing
certain apps."
Write-Output ""
Write-Output "Press any key to continue anyway..."
$null = [[Link]]::ReadKey()
}
}

# Get current Windows build version to compare against features


$WinVersion = Get-ItemPropertyValue 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion'
CurrentBuild
# Hide progress bars for app removal, as they block Win11Debloat's output
$ProgressPreference = 'SilentlyContinue'

$global:Params = $PSBoundParameters
$global:FirstSelection = $true
$SPParams = 'WhatIf', 'Confirm', 'Verbose', 'Silent', 'Sysprep'
$SPParamCount = 0

# Count how many SPParams exist within Params


# This is later used to check if any options were selected
foreach ($Param in $SPParams) {
if ($global:[Link]($Param)) {
$SPParamCount++
}
}

if ($global:[Link]("Sysprep")) {
# Exit script if default user directory or [Link] file cannot be found
if (-not (Test-Path "C:\Users\Default\[Link]")) {
Write-Host "Error: Unable to start Win11Debloat in Sysprep mode, cannot find default user folder at
'C:\Users\Default\'" -ForegroundColor Red
AwaitKeyToExit
Exit
}
# Exit script if run in Sysprep mode on Windows 10
if ($WinVersion -lt 22000) {
Write-Host "Error: Win11Debloat Sysprep mode is not supported on Windows 10" -
ForegroundColor Red
AwaitKeyToExit
Exit
}
}

# Remove SavedSettings file if it exists and is empty


if ((Test-Path "$PSScriptRoot/SavedSettings") -and ([String]::IsNullOrWhiteSpace((Get-content
"$PSScriptRoot/SavedSettings")))) {
Remove-Item -Path "$PSScriptRoot/SavedSettings" -recurse
}

# Only run the app selection form if the 'RunAppConfigurator' parameter was passed to the script
if ($RunAppConfigurator) {
PrintHeader "App Configurator"

$result = ShowAppSelectionForm

# Show different message based on whether the app selection was saved or cancelled
if ($result -ne [[Link]]::OK) {
Write-Host "App configurator was closed without saving." -ForegroundColor Red
}
else {
Write-Output "Your app selection was saved to the 'CustomAppsList' file in the root folder of the
script."
}

AwaitKeyToExit

Exit
}

# Change script execution based on provided parameters or user input


if ((-not $global:[Link]) -or $RunDefaults -or $RunWin11Defaults -or ($SPParamCount -eq
$global:[Link])) {
if ($RunDefaults -or $RunWin11Defaults) {
$Mode = '1'
}
else {
# Show menu and wait for user input, loops until valid input is provided
Do {
$ModeSelectionMessage = "Please select an option (1/2/3/0)"

PrintHeader 'Menu'

Write-Output "(1) Default Mode: Apply the default settings"


Write-Output "(2) Custom Mode: Modify the script to your needs"
Write-Output "(3) App removal mode: Select & remove apps, without making other changes"

# Only show this option if SavedSettings file exists


if (Test-Path "$PSScriptRoot/SavedSettings") {
Write-Output "(4) Apply saved custom settings from last time"

$ModeSelectionMessage = "Please select an option (1/2/3/4/0)"


}

Write-Output ""
Write-Output "(0) Show more information"
Write-Output ""
Write-Output ""

$Mode = Read-Host $ModeSelectionMessage

# Show information based on user input, Suppress user prompt if Silent parameter was passed
if ($Mode -eq '0') {
# Get & print script information from file
PrintFromFile "$PSScriptRoot/Menus/Info"

Write-Output ""
Write-Output "Press any key to go back..."
$null = [[Link]]::ReadKey()
}
elseif (($Mode -eq '4')-and -not (Test-Path "$PSScriptRoot/SavedSettings")) {
$Mode = $null
}
}
while ($Mode -ne '1' -and $Mode -ne '2' -and $Mode -ne '3' -and $Mode -ne '4')
}

# Add execution parameters based on the mode


switch ($Mode) {
# Default mode, loads defaults after confirmation
'1' {
# Print the default settings & require userconfirmation, unless Silent parameter was passed
if (-not $Silent) {
PrintFromFile "$PSScriptRoot/Menus/DefaultSettings"

Write-Output ""
Write-Output "Press enter to execute the script or press CTRL+C to quit..."
Read-Host | Out-Null
}

$DefaultParameterNames =
'RemoveApps','DisableTelemetry','DisableBing','DisableLockscreenTips','DisableSuggestions','ShowKno
wnFileExt','DisableWidgets','HideChat','DisableCopilot'
PrintHeader 'Default Mode'

# Add default parameters if they don't already exist


foreach ($ParameterName in $DefaultParameterNames) {
if (-not $global:[Link]($ParameterName)){
$global:[Link]($ParameterName, $true)
}
}

# Only add this option for Windows 10 users, if it doesn't already exist
if ((get-ciminstance -query "select caption from win32_operatingsystem where caption like
'%Windows 10%'") -and (-not $global:[Link]('Hide3dObjects'))) {
$global:[Link]('Hide3dObjects', $Hide3dObjects)
}
}

# Custom mode, show & add options based on user input


'2' {
# Get current Windows build version to compare against features
$WinVersion = Get-ItemPropertyValue 'HKLM:\SOFTWARE\Microsoft\Windows NT\
CurrentVersion' CurrentBuild

PrintHeader 'Custom Mode'

# 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
Write-Host " (1) Only remove the default selection of bloatware apps from '[Link]'" -
ForegroundColor Yellow
Write-Host " (2) Remove default selection of bloatware apps, aswell as mail & calendar apps,
developer apps and gaming apps" -ForegroundColor Yellow
Write-Host " (3) Select which apps to remove and which to keep" -ForegroundColor Yellow
$RemoveAppsInput = Read-Host "Remove any pre-installed apps? (n/1/2/3)"

# Show app selection form if user entered option 3


if ($RemoveAppsInput -eq '3') {
$result = ShowAppSelectionForm

if ($result -ne [[Link]]::OK) {


# User cancelled or closed app selection, show error and change RemoveAppsInput so the
menu will be shown again
Write-Output ""
Write-Host "Cancelled application selection, please try again" -ForegroundColor Red

$RemoveAppsInput = 'c'
}

Write-Output ""
}
}
while ($RemoveAppsInput -ne 'n' -and $RemoveAppsInput -ne '0' -and $RemoveAppsInput -ne '1'
-and $RemoveAppsInput -ne '2' -and $RemoveAppsInput -ne '3')

# Select correct option based on user input


switch ($RemoveAppsInput) {
'1' {
AddParameter 'RemoveApps' 'Remove default selection of bloatware apps'
}
'2' {
AddParameter 'RemoveApps' 'Remove default selection of bloatware apps'
AddParameter 'RemoveCommApps' 'Remove the Mail, Calendar, and People apps'
AddParameter 'RemoveW11Outlook' 'Remove the new Outlook for Windows app'
AddParameter 'RemoveDevApps' 'Remove developer-related apps'
AddParameter 'RemoveGamingApps' 'Remove the Xbox App and Xbox Gamebar'
AddParameter 'DisableDVR' 'Disable Xbox game/screen recording'
}
'3' {
Write-Output "You have selected $($global:[Link]) apps for removal"

AddParameter 'RemoveAppsCustom' "Remove $($global:[Link]) apps:"

Write-Output ""

if ($( Read-Host -Prompt "Disable Xbox game/screen recording? Also stops gaming overlay
popups (y/n)" ) -eq 'y') {
AddParameter 'DisableDVR' 'Disable Xbox game/screen recording'
}
}
}

# Only show this option for Windows 11 users running build 22621 or later
if ($WinVersion -ge 22621){
Write-Output ""

if ($global:[Link]("Sysprep")) {
if ($( Read-Host -Prompt "Remove all pinned apps from the start menu for all existing and
new users? (y/n)" ) -eq 'y') {
AddParameter 'ClearStartAllUsers' 'Remove all pinned apps from the start menu for
existing and new users'
}
}
else {
Do {
Write-Host "Options:" -ForegroundColor Yellow
Write-Host " (n) Don't remove any pinned apps from the start menu" -ForegroundColor
Yellow
Write-Host " (1) Remove all pinned apps from the start menu for this user only ($
([Environment]::UserName))" -ForegroundColor Yellow
Write-Host " (2) Remove all pinned apps from the start menu for all existing and new
users" -ForegroundColor Yellow
$ClearStartInput = Read-Host "Remove all pinned apps from the start menu? This cannot
be reverted (n/1/2)"
}
while ($ClearStartInput -ne 'n' -and $ClearStartInput -ne '0' -and $ClearStartInput -ne '1' -and
$ClearStartInput -ne '2')

# Select correct option based on user input


switch ($ClearStartInput) {
'1' {
AddParameter 'ClearStart' "Remove all pinned apps from the start menu for this user
only"
}
'2' {
AddParameter 'ClearStartAllUsers' "Remove all pinned apps from the start menu for all
existing and new users"
}
}
}
}

Write-Output ""

if ($( Read-Host -Prompt "Disable telemetry, diagnostic data, activity history, app-launch tracking
and targeted ads? (y/n)" ) -eq 'y') {
AddParameter 'DisableTelemetry' 'Disable telemetry, diagnostic data, activity history, app-
launch tracking & targeted ads'
}

Write-Output ""

if ($( Read-Host -Prompt "Disable tips, tricks, suggestions and ads in start, settings, notifications,
explorer and lockscreen? (y/n)" ) -eq 'y') {
AddParameter 'DisableSuggestions' 'Disable tips, tricks, suggestions and ads in start, settings,
notifications and File Explorer'
AddParameter 'DisableLockscreenTips' 'Disable tips & tricks on the lockscreen'
}

Write-Output ""

if ($( Read-Host -Prompt "Disable & remove bing web search, bing AI & cortana in Windows
search? (y/n)" ) -eq 'y') {
AddParameter 'DisableBing' 'Disable & remove bing web search, bing AI & cortana in
Windows search'
}

# Only show this option for Windows 11 users running build 22621 or later
if ($WinVersion -ge 22621){
Write-Output ""

if ($( Read-Host -Prompt "Disable Windows Copilot? This applies to all users (y/n)" ) -eq 'y') {
AddParameter 'DisableCopilot' 'Disable Windows copilot'
}

Write-Output ""
if ($( Read-Host -Prompt "Disable Windows Recall snapshots? This applies to all users (y/n)" )
-eq 'y') {
AddParameter 'DisableRecall' 'Disable Windows Recall snapshots'
}
}

# Only show this option for Windows 11 users running build 22000 or later
if ($WinVersion -ge 22000){
Write-Output ""

if ($( Read-Host -Prompt "Restore the old Windows 10 style context menu? (y/n)" ) -eq 'y') {
AddParameter 'RevertContextMenu' 'Restore the old Windows 10 style context menu'
}
}

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
if ($WinVersion -ge 22000){
Write-Output ""

if ($( Read-Host -Prompt " Align taskbar buttons to the left side? (y/n)" ) -eq 'y') {
AddParameter 'TaskbarAlignLeft' 'Align taskbar icons to the left'
}

# 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
$TbSearchInput = Read-Host " Hide or change the search icon on the taskbar?
(n/1/2/3/4)"
}
while ($TbSearchInput -ne 'n' -and $TbSearchInput -ne '0' -and $TbSearchInput -ne '1' -and
$TbSearchInput -ne '2' -and $TbSearchInput -ne '3' -and $TbSearchInput -ne '4')

# Select correct taskbar search option based on user input


switch ($TbSearchInput) {
'1' {
AddParameter 'HideSearchTb' 'Hide search icon from the taskbar'
}
'2' {
AddParameter 'ShowSearchIconTb' 'Show search icon on the taskbar'
}
'3' {
AddParameter 'ShowSearchLabelTb' 'Show search icon with label on the taskbar'
}
'4' {
AddParameter 'ShowSearchBoxTb' 'Show search box on the taskbar'
}
}

Write-Output ""

if ($( Read-Host -Prompt " Hide the taskview button from the taskbar? (y/n)" ) -eq 'y') {
AddParameter 'HideTaskview' 'Hide the taskview button from the taskbar'
}
}

Write-Output ""

if ($( Read-Host -Prompt " Disable the widgets service and hide the icon from the taskbar?
(y/n)" ) -eq 'y') {
AddParameter 'DisableWidgets' 'Disable the widget service & hide the widget (news and
interests) icon from the taskbar'
}

# Only show this options for Windows users running build 22621 or earlier
if ($WinVersion -le 22621){
Write-Output ""

if ($( Read-Host -Prompt " Hide the chat (meet now) icon from the taskbar? (y/n)" ) -eq 'y')
{
AddParameter 'HideChat' 'Hide the chat (meet now) icon from the taskbar'
}
}
}

Write-Output ""

if ($( Read-Host -Prompt "Do you want to make any changes to File Explorer? (y/n)" ) -eq 'y') {
Write-Output ""

if ($( Read-Host -Prompt " Show hidden files, folders and drives? (y/n)" ) -eq 'y') {
AddParameter 'ShowHiddenFolders' 'Show hidden files, folders and drives'
}
Write-Output ""

if ($( Read-Host -Prompt " Show file extensions for known file types? (y/n)" ) -eq 'y') {
AddParameter 'ShowKnownFileExt' 'Show file extensions for known file types'
}

# Only show this option for Windows 11 users running build 22000 or later
if ($WinVersion -ge 22000){
Write-Output ""

if ($( Read-Host -Prompt " Hide the gallery section from the File Explorer sidepanel? (y/n)"
) -eq 'y') {
AddParameter 'HideGallery' 'Hide the gallery section from the File Explorer sidepanel'
}
}

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') {
AddParameter 'HideDupliDrive' 'Hide duplicate removable drive entries from the File
Explorer sidepanel'
}

# Only show option for disabling these specific folders for Windows 10 users
if (get-ciminstance -query "select caption from win32_operatingsystem where caption like
'%Windows 10%'"){
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') {
AddParameter 'HideOnedrive' 'Hide the onedrive folder in the File Explorer sidepanel'
}

Write-Output ""

if ($( Read-Host -Prompt " Hide the 3D objects folder from the File Explorer sidepanel?
(y/n)" ) -eq 'y') {
AddParameter 'Hide3dObjects' "Hide the 3D objects folder under 'This pc' in File
Explorer"
}

Write-Output ""

if ($( Read-Host -Prompt " Hide the music folder from the File Explorer sidepanel? (y/n)"
) -eq 'y') {
AddParameter 'HideMusic' "Hide the music folder under 'This pc' in File Explorer"
}
}
}
}

# Only show option for disabling context menu items for Windows 10 users or if the user opted to
restore the Windows 10 context menu
if ((get-ciminstance -query "select caption from win32_operatingsystem where caption like
'%Windows 10%'") -or $global:[Link]('RevertContextMenu')){
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') {
AddParameter 'HideIncludeInLibrary' "Hide the 'Include in library' option in the context
menu"
}

Write-Output ""

if ($( Read-Host -Prompt " Hide the 'Give access to' option in the context menu? (y/n)" ) -eq
'y') {
AddParameter 'HideGiveAccessTo' "Hide the 'Give access to' option in the context menu"
}

Write-Output ""

if ($( Read-Host -Prompt " Hide the 'Share' option in the context menu? (y/n)" ) -eq 'y') {
AddParameter 'HideShare' "Hide the 'Share' option in the context menu"
}
}
}

# 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'
}

# App removal, remove apps based on user selection


'3' {
PrintHeader "App Removal"

$result = ShowAppSelectionForm

if ($result -eq [[Link]]::OK) {


Write-Output "You have selected $($global:[Link]) apps for removal"
AddParameter 'RemoveAppsCustom' "Remove $($global:[Link]) apps:"

# Suppress prompt if Silent parameter was passed


if (-not $Silent) {
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 ""
}
}

# Load custom options selection from the "SavedSettings" file


'4' {
if (-not $Silent) {
PrintHeader 'Custom Mode'
Write-Output "Win11Debloat will make the following changes:"

# Get & print default settings info from file


Foreach ($line in (Get-Content -Path "$PSScriptRoot/SavedSettings" )) {
# Remove any spaces before and after the Appname
$line = $[Link]()

# Check if line has # char, show description, add parameter


if (-not ($[Link]('#') -eq -1)) {
Write-Output $[Link](($[Link]('#') + 1), ($[Link] - $[Link]('#') -
1))
$paramName = $[Link](0, $[Link]('#'))

if ($paramName -eq "RemoveAppsCustom") {


# If paramName is RemoveAppsCustom, check if CustomAppsFile exists
if (Test-Path "$PSScriptRoot/CustomAppsList") {
# Apps file exists, print list of apps
$appsList = @()

# Get apps list from file


Foreach ($app in (Get-Content -Path "$PSScriptRoot/CustomAppsList" )) {
# Remove any spaces before and after the app name
$app = $[Link]()

$appsList += $app
}

Write-Host $appsList -ForegroundColor DarkGray


}
else {
# Apps file does not exist, print error and continue to next item
Write-Host "Error: Could not load custom apps list from file, no apps will be
removed!" -ForegroundColor Red
continue
}
}

if (-not $global:[Link]($ParameterName)){
$global:[Link]($paramName, $true)
}
}
}

Write-Output ""
Write-Output ""
Write-Output "Press enter to execute the script or press CTRL+C to quit..."
Read-Host | Out-Null
}

PrintHeader 'Custom Mode'


}
}
}
else {
PrintHeader 'Custom Mode'
}
# If the number of keys in SPParams equals the number of keys in Params then no modifications/changes
were selected
# or added by the user, and the script can exit without making any changes.
if ($SPParamCount -eq $global:[Link]) {
Write-Output "The script completed without making any changes."

AwaitKeyToExit
}
else {
# Execute all selected/provided parameters
switch ($global:[Link]) {
'RemoveApps' {
RemoveAppsFromFile "$PSScriptRoot/[Link]"
continue
}
'RemoveAppsCustom' {
if (Test-Path "$PSScriptRoot/CustomAppsList") {
$appsList = @()

# Get apps list from file


Foreach ($app in (Get-Content -Path "$PSScriptRoot/CustomAppsList" )) {
# Remove any spaces before and after the app name
$app = $[Link]()

$appsList += $app
}

Write-Output "> Removing $($[Link]) apps..."


RemoveApps $appsList
}
else {
Write-Host "> Could not load custom apps list from file, no apps were removed!" -
ForegroundColor Red
}

Write-Output ""
continue
}
'RemoveCommApps' {
Write-Output "> Removing Mail, Calendar and People apps..."

$appsList = '[Link]', '[Link]'


RemoveApps $appsList

Write-Output ""
continue
}
'RemoveW11Outlook' {
Write-Output "> Removing new Outlook for Windows app..."

$appsList = '[Link]'
RemoveApps $appsList

Write-Output ""
continue
}
'RemoveDevApps' {
Write-Output "> Removing developer-related related apps..."

$appsList = '[Link]', '[Link]',


'[Link]'
RemoveApps $appsList

Write-Output ""

continue
}
'RemoveGamingApps' {
Write-Output "> Removing gaming related apps..."

$appsList = '[Link]', '[Link]',


'[Link]'
RemoveApps $appsList

Write-Output ""

continue
}
"ForceRemoveEdge" {
ForceRemoveEdge
continue
}
'DisableDVR' {
RegImport "> Disabling Xbox game/screen recording..." "Disable_DVR.reg"
continue
}
'ClearStart' {
ClearStartMenu "> Removing all pinned apps from the start menu..." $False
continue
}
'ClearStartAllUsers' {
ClearStartMenu "> Removing all pinned apps from the start menu for all users..."
continue
}
'DisableTelemetry' {
RegImport "> Disabling telemetry, diagnostic data, activity history, app-launch tracking and
targeted ads..." "Disable_Telemetry.reg"
continue
}
{$_ -in "DisableBingSearches", "DisableBing"} {
RegImport "> Disabling bing web search, bing AI & cortana in Windows search..."
"Disable_Bing_Cortana_In_Search.reg"

# Also remove the app package for bing search


$appsList = '[Link]'
RemoveApps $appsList

Write-Output ""

continue
}
{$_ -in "DisableLockscrTips", "DisableLockscreenTips"} {
RegImport "> Disabling tips & tricks on the lockscreen..." "Disable_Lockscreen_Tips.reg"
continue
}
{$_ -in "DisableSuggestions", "DisableWindowsSuggestions"} {
RegImport "> Disabling tips, tricks, suggestions and ads across Windows..."
"Disable_Windows_Suggestions.reg"
continue
}
'RevertContextMenu' {
RegImport "> Restoring the old Windows 10 style context menu..."
"Disable_Show_More_Options_Context_Menu.reg"
continue
}
'TaskbarAlignLeft' {
RegImport "> Aligning taskbar buttons to the left..." "Align_Taskbar_Left.reg"

continue
}
'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
}
'DisableCopilot' {
RegImport "> Disabling Windows copilot..." "Disable_Copilot.reg"
continue
}
'DisableRecall' {
RegImport "> Disabling Windows Recall snapshots..." "Disable_AI_Recall.reg"
continue
}
{$_ -in "HideWidgets", "DisableWidgets"} {
RegImport "> Disabling the widget service and hiding the widget icon from the taskbar..."
"Disable_Widgets_Taskbar.reg"
continue
}
{$_ -in "HideChat", "DisableChat"} {
RegImport "> Hiding the chat icon from the taskbar..." "Disable_Chat_Taskbar.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
}
'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"} {
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
}
}

RestartExplorer

Write-Output ""
Write-Output ""
Write-Output ""
Write-Output "Script completed successfully!"

AwaitKeyToExit
}

Common questions

Powered by AI

The 'Strip-Progress' function cleans console output by employing regex to remove progress spinners and unnecessary size formatting. This enhances readability by filtering out distracting elements, ensuring that only relevant output remains visible, which facilitates easier monitoring and debugging of the script's execution .

Custom user settings are handled using the 'AddParameter' function that saves parameters in a 'SavedSettings' file. The script allows users to apply these saved settings during subsequent runs, thereby facilitating consistent configuration across sessions. Conditions ensure this option only appears when the 'SavedSettings' file is available, allowing users to reapply custom setups efficiently .

The script checks the Windows OS version and architecture before executing specific functions, such as knowing when to restart the explorer process and applying registry changes. It includes conditions that validate the script's mode compatibility, such as preventing 'Sysprep' mode on Windows 10 and ensuring process architecture alignment when restarting the explorer .

Taskbar customization involves multiple conditional user prompts to align icons and hide specific buttons or icons. It uses parameters such as 'TaskbarAlignLeft' to move icons to the left, and offers options to hide or modify the search icon, taskview button, widget, and chat icon, accommodating user preferences and differentiating between Windows 10 and Windows 11 capabilities .

User input is integral to the script's functionality, guiding choices about whether to align taskbar icons, show/hide certain buttons, and modify appearance settings like taskbar search options. Through prompts, users are actively involved in determining which features and settings to apply, ensuring tailor-fitted configurations that reflect personal preferences .

The script first checks for the existence of the 'start2.bin' file, which is necessary for clearing the start menu. If this file is missing, the script outputs an error message indicating that it cannot proceed due to the missing file, and it ceases the operation at that point. This checking mechanism ensures that necessary files are in place before attempting any operation .

Uninstalling Microsoft Edge involves several registry removal steps to ensure it does not auto-launch. This includes deleting specific registry entries such as 'MicrosoftEdgeAutoLaunch_A9F6DCE4ABADF4F51CF45CD7129E3C6C' and 'Microsoft Edge Update' from both the 'Run' and 'StartupApproved\Run' paths under 'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion'. If the uninstaller cannot be found, a message is displayed that the operation was unsuccessful .

The script manages registry modifications through functions like 'RegImport', which take care of disabling specific services and features such as telemetry, tips, and context menu options. Registry entries are loaded, modified, and unloaded cautiously, ensuring modifications are applied only when default files and paths are available .

If 'winget' is not installed or is outdated, which might hinder some app removal processes, the script issues a warning. It informs the user that this could limit the functionality of app removal within the script. Even with 'winget' absence or outdated status, users can choose to continue using the script with a prompt acknowledgment .

The script uses the 'ClearStartMenu' function to manage Start Menu configurations. This function involves checking for a template file, backing up existing start menu configurations, and applying the template to all or specific users. It also handles default profiles by creating directory structures if necessary and copying the template file into these structures .

You might also like