|
|
|
@@ -29,13 +29,12 @@ param (
|
|
|
|
|
[switch]$DisableStartRecommended,
|
|
|
|
|
[switch]$DisableCopilot,
|
|
|
|
|
[switch]$DisableRecall,
|
|
|
|
|
[switch]$DisableWidgets,
|
|
|
|
|
[switch]$HideWidgets,
|
|
|
|
|
[switch]$DisableChat,
|
|
|
|
|
[switch]$HideChat,
|
|
|
|
|
[switch]$DisableWidgets, [switch]$HideWidgets,
|
|
|
|
|
[switch]$DisableChat, [switch]$HideChat,
|
|
|
|
|
[switch]$ClearStart,
|
|
|
|
|
[switch]$ClearStartAllUsers,
|
|
|
|
|
[switch]$RevertContextMenu,
|
|
|
|
|
[switch]$DisableMouseAcceleration,
|
|
|
|
|
[switch]$HideHome,
|
|
|
|
|
[switch]$HideGallery,
|
|
|
|
|
[switch]$ExplorerToHome,
|
|
|
|
@@ -51,7 +50,7 @@ param (
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Show error if current powershell environment does not have LanguageMode set to FullLanguage
|
|
|
|
|
# Show error if current powershell environment is limited by security policies
|
|
|
|
|
if ($ExecutionContext.SessionState.LanguageMode -ne "FullLanguage") {
|
|
|
|
|
Write-Host "Error: Win11Debloat is unable to run on your system, powershell execution is restricted by security policies" -ForegroundColor Red
|
|
|
|
|
Write-Output ""
|
|
|
|
@@ -551,13 +550,17 @@ function RestartExplorer {
|
|
|
|
|
|
|
|
|
|
Write-Output "> Restarting Windows Explorer process to apply all changes... (This may cause some flickering)"
|
|
|
|
|
|
|
|
|
|
if ($global:Params.ContainsKey("DisableMouseAcceleration")) {
|
|
|
|
|
Write-Host "Warning: The Enhance Pointer Precision setting has been changed, this setting will only take effect after a reboot" -ForegroundColor Yellow
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# 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."
|
|
|
|
|
Write-Warning "Unable to restart Windows Explorer process, please manually reboot your PC to apply all changes."
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -710,184 +713,7 @@ function AwaitKeyToExit {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
##################################################################################################################
|
|
|
|
|
# #
|
|
|
|
|
# SCRIPT START #
|
|
|
|
|
# #
|
|
|
|
|
##################################################################################################################
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Check if winget is installed & if it is, check if the version is at least v1.4
|
|
|
|
|
if ((Get-AppxPackage -Name "*Microsoft.DesktopAppInstaller*") -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 = [System.Console]::ReadKey()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Get current Windows build version to compare against features
|
|
|
|
|
$WinVersion = Get-ItemPropertyValue 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' CurrentBuild
|
|
|
|
|
|
|
|
|
|
$global:Params = $PSBoundParameters
|
|
|
|
|
$global:FirstSelection = $true
|
|
|
|
|
$SPParams = 'WhatIf', 'Confirm', 'Verbose', 'Silent', 'Sysprep', 'Debug'
|
|
|
|
|
$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:Params.ContainsKey($Param)) {
|
|
|
|
|
$SPParamCount++
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Hide progress bars for app removal, as they block Win11Debloat's output
|
|
|
|
|
if (-not ($global:Params.ContainsKey("Verbose"))) {
|
|
|
|
|
$ProgressPreference = 'SilentlyContinue'
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
Read-Host "Verbose mode is enabled, press enter to continue"
|
|
|
|
|
$ProgressPreference = 'Continue'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($global:Params.ContainsKey("Sysprep")) {
|
|
|
|
|
$defaultUserPath = $env:USERPROFILE -Replace ('\\' + $env:USERNAME + '$'), '\Default\NTUSER.DAT'
|
|
|
|
|
|
|
|
|
|
# Exit script if default user directory or NTUSER.DAT file cannot be found
|
|
|
|
|
if (-not (Test-Path "$defaultUserPath")) {
|
|
|
|
|
Write-Host "Error: Unable to start Win11Debloat in Sysprep mode, cannot find default user folder at '$defaultUserPath'" -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 [System.Windows.Forms.DialogResult]::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:Params.Count) -or $RunDefaults -or $RunWin11Defaults -or $RunSavedSettings -or ($SPParamCount -eq $global:Params.Count)) {
|
|
|
|
|
if ($RunDefaults -or $RunWin11Defaults) {
|
|
|
|
|
$Mode = '1'
|
|
|
|
|
}
|
|
|
|
|
elseif ($RunSavedSettings) {
|
|
|
|
|
if(-not (Test-Path "$PSScriptRoot/SavedSettings")) {
|
|
|
|
|
PrintHeader 'Custom Mode'
|
|
|
|
|
Write-Host "Error: No saved settings found, no changes were made" -ForegroundColor Red
|
|
|
|
|
AwaitKeyToExit
|
|
|
|
|
Exit
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$Mode = '4'
|
|
|
|
|
}
|
|
|
|
|
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/Assets/Menus/Info"
|
|
|
|
|
|
|
|
|
|
Write-Output ""
|
|
|
|
|
Write-Output "Press any key to go back..."
|
|
|
|
|
$null = [System.Console]::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/Assets/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','ShowKnownFileExt','DisableWidgets','HideChat','DisableCopilot'
|
|
|
|
|
|
|
|
|
|
PrintHeader 'Default Mode'
|
|
|
|
|
|
|
|
|
|
# Add default parameters if they don't already exist
|
|
|
|
|
foreach ($ParameterName in $DefaultParameterNames) {
|
|
|
|
|
if (-not $global:Params.ContainsKey($ParameterName)){
|
|
|
|
|
$global:Params.Add($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:Params.ContainsKey('Hide3dObjects'))) {
|
|
|
|
|
$global:Params.Add('Hide3dObjects', $Hide3dObjects)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Custom mode, show & add options based on user input
|
|
|
|
|
'2' {
|
|
|
|
|
function DisplayCustomModeOptions {
|
|
|
|
|
# Get current Windows build version to compare against features
|
|
|
|
|
$WinVersion = Get-ItemPropertyValue 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' CurrentBuild
|
|
|
|
|
|
|
|
|
@@ -989,6 +815,37 @@ if ((-not $global:Params.Count) -or $RunDefaults -or $RunWin11Defaults -or $RunS
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Write-Output ""
|
|
|
|
|
|
|
|
|
|
if ($( Read-Host -Prompt "Turn off Enhance Pointer Precision, also known as mouse acceleration? (y/n)" ) -eq 'y') {
|
|
|
|
|
AddParameter 'DisableMouseAcceleration' 'Turn off Enhance Pointer Precision (mouse acceleration)'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# 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:Params.ContainsKey('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"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Only show this option for Windows 11 users running build 22621 or later
|
|
|
|
|
if ($WinVersion -ge 22621){
|
|
|
|
|
Write-Output ""
|
|
|
|
@@ -1184,31 +1041,6 @@ if ((-not $global:Params.Count) -or $RunDefaults -or $RunWin11Defaults -or $RunS
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# 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:Params.ContainsKey('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 ""
|
|
|
|
@@ -1219,6 +1051,188 @@ if ((-not $global:Params.Count) -or $RunDefaults -or $RunWin11Defaults -or $RunS
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PrintHeader 'Custom Mode'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
##################################################################################################################
|
|
|
|
|
# #
|
|
|
|
|
# SCRIPT START #
|
|
|
|
|
# #
|
|
|
|
|
##################################################################################################################
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Check if winget is installed & if it is, check if the version is at least v1.4
|
|
|
|
|
if ((Get-AppxPackage -Name "*Microsoft.DesktopAppInstaller*") -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 = [System.Console]::ReadKey()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Get current Windows build version to compare against features
|
|
|
|
|
$WinVersion = Get-ItemPropertyValue 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' CurrentBuild
|
|
|
|
|
|
|
|
|
|
$global:Params = $PSBoundParameters
|
|
|
|
|
$global:FirstSelection = $true
|
|
|
|
|
$SPParams = 'WhatIf', 'Confirm', 'Verbose', 'Silent', 'Sysprep', 'Debug'
|
|
|
|
|
$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:Params.ContainsKey($Param)) {
|
|
|
|
|
$SPParamCount++
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Hide progress bars for app removal, as they block Win11Debloat's output
|
|
|
|
|
if (-not ($global:Params.ContainsKey("Verbose"))) {
|
|
|
|
|
$ProgressPreference = 'SilentlyContinue'
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
Read-Host "Verbose mode is enabled, press enter to continue"
|
|
|
|
|
$ProgressPreference = 'Continue'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($global:Params.ContainsKey("Sysprep")) {
|
|
|
|
|
$defaultUserPath = $env:USERPROFILE -Replace ('\\' + $env:USERNAME + '$'), '\Default\NTUSER.DAT'
|
|
|
|
|
|
|
|
|
|
# Exit script if default user directory or NTUSER.DAT file cannot be found
|
|
|
|
|
if (-not (Test-Path "$defaultUserPath")) {
|
|
|
|
|
Write-Host "Error: Unable to start Win11Debloat in Sysprep mode, cannot find default user folder at '$defaultUserPath'" -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 [System.Windows.Forms.DialogResult]::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:Params.Count) -or $RunDefaults -or $RunWin11Defaults -or $RunSavedSettings -or ($SPParamCount -eq $global:Params.Count)) {
|
|
|
|
|
if ($RunDefaults -or $RunWin11Defaults) {
|
|
|
|
|
$Mode = '1'
|
|
|
|
|
}
|
|
|
|
|
elseif ($RunSavedSettings) {
|
|
|
|
|
if(-not (Test-Path "$PSScriptRoot/SavedSettings")) {
|
|
|
|
|
PrintHeader 'Custom Mode'
|
|
|
|
|
Write-Host "Error: No saved settings found, no changes were made" -ForegroundColor Red
|
|
|
|
|
AwaitKeyToExit
|
|
|
|
|
Exit
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$Mode = '4'
|
|
|
|
|
}
|
|
|
|
|
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/Assets/Menus/Info"
|
|
|
|
|
|
|
|
|
|
Write-Output ""
|
|
|
|
|
Write-Output "Press any key to go back..."
|
|
|
|
|
$null = [System.Console]::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/Assets/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','ShowKnownFileExt','DisableWidgets','HideChat','DisableCopilot'
|
|
|
|
|
|
|
|
|
|
PrintHeader 'Default Mode'
|
|
|
|
|
|
|
|
|
|
# Add default parameters if they don't already exist
|
|
|
|
|
foreach ($ParameterName in $DefaultParameterNames) {
|
|
|
|
|
if (-not $global:Params.ContainsKey($ParameterName)){
|
|
|
|
|
$global:Params.Add($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:Params.ContainsKey('Hide3dObjects'))) {
|
|
|
|
|
$global:Params.Add('Hide3dObjects', $Hide3dObjects)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Custom mode, show & add options based on user input
|
|
|
|
|
'2' {
|
|
|
|
|
DisplayCustomModeOptions
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# App removal, remove apps based on user selection
|
|
|
|
@@ -1357,26 +1371,12 @@ else {
|
|
|
|
|
RegImport "> Disabling Xbox game/screen recording..." "Disable_DVR.reg"
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
'ClearStart' {
|
|
|
|
|
Write-Output "> Removing all pinned apps from the start menu for user $env:USERNAME..."
|
|
|
|
|
ReplaceStartMenu
|
|
|
|
|
Write-Output ""
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
'ClearStartAllUsers' {
|
|
|
|
|
ReplaceStartMenuForAllUsers
|
|
|
|
|
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 = 'Microsoft.BingSearch'
|
|
|
|
|
RemoveApps $appsList
|
|
|
|
|
{$_ -in "DisableSuggestions", "DisableWindowsSuggestions"} {
|
|
|
|
|
RegImport "> Disabling tips, tricks, suggestions and ads across Windows..." "Disable_Windows_Suggestions.reg"
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
'DisableDesktopSpotlight' {
|
|
|
|
@@ -1387,14 +1387,48 @@ else {
|
|
|
|
|
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"
|
|
|
|
|
{$_ -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 = 'Microsoft.BingSearch'
|
|
|
|
|
RemoveApps $appsList
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
'DisableCopilot' {
|
|
|
|
|
RegImport "> Disabling & removing Windows Copilot..." "Disable_Copilot.reg"
|
|
|
|
|
|
|
|
|
|
# Also remove the app package for bing search
|
|
|
|
|
$appsList = 'Microsoft.Copilot'
|
|
|
|
|
RemoveApps $appsList
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
'DisableRecall' {
|
|
|
|
|
RegImport "> Disabling Windows Recall snapshots..." "Disable_AI_Recall.reg"
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
'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
|
|
|
|
|
}
|
|
|
|
|
'ClearStart' {
|
|
|
|
|
Write-Output "> Removing all pinned apps from the start menu for user $env:USERNAME..."
|
|
|
|
|
ReplaceStartMenu
|
|
|
|
|
Write-Output ""
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
'ClearStartAllUsers' {
|
|
|
|
|
ReplaceStartMenuForAllUsers
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
'DisableStartRecommended' {
|
|
|
|
|
RegImport "> Disabling and hiding the start menu recommended section..." "Disable_Start_Recommended.reg"
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
'TaskbarAlignLeft' {
|
|
|
|
|
RegImport "> Aligning taskbar buttons to the left..." "Align_Taskbar_Left.reg"
|
|
|
|
|
|
|
|
|
@@ -1420,22 +1454,6 @@ else {
|
|
|
|
|
RegImport "> Hiding the taskview button from the taskbar..." "Hide_Taskview_Taskbar.reg"
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
'DisableStartRecommended' {
|
|
|
|
|
RegImport "> Disabling and hiding the start menu recommended section..." "Disable_Start_Recommended.reg"
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
'DisableCopilot' {
|
|
|
|
|
RegImport "> Disabling & removing Windows Copilot..." "Disable_Copilot.reg"
|
|
|
|
|
|
|
|
|
|
# Also remove the app package for bing search
|
|
|
|
|
$appsList = 'Microsoft.Copilot'
|
|
|
|
|
RemoveApps $appsList
|
|
|
|
|
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
|
|
|
|
@@ -1444,22 +1462,6 @@ else {
|
|
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|
'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
|
|
|
|
|
}
|
|
|
|
|
'ExplorerToHome' {
|
|
|
|
|
RegImport "> Changing the default location that File Explorer opens to `Home`..." "Launch_File_Explorer_To_Home.reg"
|
|
|
|
|
continue
|
|
|
|
@@ -1476,6 +1478,22 @@ else {
|
|
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|
'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
|
|
|
|
|