Add option to turn off Enhance Pointer Precision #197

This commit is contained in:
Raphire
2025-02-13 21:08:47 +01:00
parent c5e0ba3e59
commit d42019ccc0
7 changed files with 434 additions and 396 deletions

View File

@@ -44,7 +44,8 @@ Context menu
- Hide the 'Include in library', 'Give access to' & 'Share' options from the context menu. (W10 only) - Hide the 'Include in library', 'Give access to' & 'Share' options from the context menu. (W10 only)
Other Other
- Disable Xbox game/screen recording. (Also stops gaming overlay popups) - Disable Xbox game/screen recording, this also stops gaming overlay popups.
- Turn off Enhance Pointer Precision, also known as mouse acceleration.
- Sysprep mode to apply changes to the Windows Default user profile. - Sysprep mode to apply changes to the Windows Default user profile.
------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------

View File

@@ -27,13 +27,12 @@ param (
[switch]$DisableStartRecommended, [switch]$DisableStartRecommended,
[switch]$DisableCopilot, [switch]$DisableCopilot,
[switch]$DisableRecall, [switch]$DisableRecall,
[switch]$DisableWidgets, [switch]$DisableWidgets, [switch]$HideWidgets,
[switch]$HideWidgets, [switch]$DisableChat, [switch]$HideChat,
[switch]$DisableChat,
[switch]$HideChat,
[switch]$ClearStart, [switch]$ClearStart,
[switch]$ClearStartAllUsers, [switch]$ClearStartAllUsers,
[switch]$RevertContextMenu, [switch]$RevertContextMenu,
[switch]$DisableMouseAcceleration,
[switch]$HideHome, [switch]$HideHome,
[switch]$HideGallery, [switch]$HideGallery,
[switch]$ExplorerToHome, [switch]$ExplorerToHome,

View File

@@ -57,7 +57,8 @@ The script also includes many features that system administrators will enjoy. Su
#### Other #### Other
- Disable Xbox game/screen recording. (Also stops gaming overlay popups) - Disable Xbox game/screen recording, this also stops gaming overlay popups.
- Turn off Enhance Pointer Precision, also known as mouse acceleration.
- Sysprep mode to apply changes to the Windows Default user profile. - Sysprep mode to apply changes to the Windows Default user profile.
### Default Settings ### Default Settings
@@ -312,11 +313,14 @@ The quick and advanced usage methods support switch parameters. A table of all t
| -ClearStart | Remove all pinned apps from start for the current user (Windows 11 update 22H2 or later only) | | -ClearStart | Remove all pinned apps from start for the current user (Windows 11 update 22H2 or later only) |
| -ClearStartAllUsers | Remove all pinned apps from start for all existing and new users. (Windows 11 update 22H2 or later only) | | -ClearStartAllUsers | Remove all pinned apps from start for all existing and new users. (Windows 11 update 22H2 or later only) |
| -DisableTelemetry | Disable telemetry, diagnostic data & targeted ads. | | -DisableTelemetry | Disable telemetry, diagnostic data & targeted ads. |
| -DisableBing | Disable & remove Bing web search, Bing AI & Cortana in Windows search. |
| -DisableSuggestions | Disable tips, tricks, suggestions and ads in start, settings, notifications and File Explorer. | | -DisableSuggestions | Disable tips, tricks, suggestions and ads in start, settings, notifications and File Explorer. |
| -DisableDesktopSpotlight | Disable the 'Windows Spotlight' desktop background option. | | -DisableDesktopSpotlight | Disable the 'Windows Spotlight' desktop background option. |
| -DisableLockscreenTips | Disable tips & tricks on the lockscreen. | | -DisableLockscreenTips | Disable tips & tricks on the lockscreen. |
| -DisableBing | Disable & remove Bing web search, Bing AI & Cortana in Windows search. |
| -DisableCopilot | Disable and remove Windows Copilot. (Windows 11 only) |
| -DisableRecall | Disable Windows Recall snapshots. (Windows 11 only) |
| -RevertContextMenu | Restore the old Windows 10 style context menu. (Windows 11 only) | | -RevertContextMenu | Restore the old Windows 10 style context menu. (Windows 11 only) |
| -DisableMouseAcceleration | Turn off Enhance Pointer Precision, also known as mouse acceleration. Requires reboot to apply. |
| -ShowHiddenFolders | Show hidden files, folders and drives. | | -ShowHiddenFolders | Show hidden files, folders and drives. |
| -ShowKnownFileExt | Show file extensions for known file types. | | -ShowKnownFileExt | Show file extensions for known file types. |
| -HideDupliDrive | Hide duplicate removable drive entries from the File Explorer navigation pane, so only the entry under 'This PC' remains. | | -HideDupliDrive | Hide duplicate removable drive entries from the File Explorer navigation pane, so only the entry under 'This PC' remains. |
@@ -329,8 +333,6 @@ The quick and advanced usage methods support switch parameters. A table of all t
| -HideChat | Hide the chat (meet now) icon from the taskbar. | | -HideChat | Hide the chat (meet now) icon from the taskbar. |
| -DisableWidgets | Disable the widget service & hide the widget (news and interests) icon from the taskbar. | | -DisableWidgets | Disable the widget service & hide the widget (news and interests) icon from the taskbar. |
| <pre>-DisableStartRecommended</pre> | Disable & hide the recommended section in the start menu. This will also change the start menu layout to `More pins`. | | <pre>-DisableStartRecommended</pre> | Disable & hide the recommended section in the start menu. This will also change the start menu layout to `More pins`. |
| -DisableCopilot | Disable and remove Windows Copilot. (Windows 11 only) |
| -DisableRecall | Disable Windows Recall snapshots. (Windows 11 only) |
| -HideHome | Hide the home section from the File Explorer navigation pane and add a toggle in the File Explorer folder options. (Windows 11 only) | | -HideHome | Hide the home section from the File Explorer navigation pane and add a toggle in the File Explorer folder options. (Windows 11 only) |
| -HideGallery | Hide the gallery section from the File Explorer navigation pane and add a toggle in the File Explorer folder options. (Windows 11 only) | | -HideGallery | Hide the gallery section from the File Explorer navigation pane and add a toggle in the File Explorer folder options. (Windows 11 only) |
| -ExplorerToHome | Changes the page that File Explorer opens to `Home`. | | -ExplorerToHome | Changes the page that File Explorer opens to `Home`. |

View File

@@ -0,0 +1,6 @@
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Control Panel\Mouse]
"MouseSpeed"="0"
"MouseThreshold1"="0"
"MouseThreshold2"="0"

View File

@@ -0,0 +1,6 @@
Windows Registry Editor Version 5.00
[hkey_users\default\Control Panel\Mouse]
"MouseSpeed"="0"
"MouseThreshold1"="0"
"MouseThreshold2"="0"

View File

@@ -0,0 +1,6 @@
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Control Panel\Mouse]
"MouseSpeed"="1"
"MouseThreshold1"="6"
"MouseThreshold2"="10"

View File

@@ -29,13 +29,12 @@ param (
[switch]$DisableStartRecommended, [switch]$DisableStartRecommended,
[switch]$DisableCopilot, [switch]$DisableCopilot,
[switch]$DisableRecall, [switch]$DisableRecall,
[switch]$DisableWidgets, [switch]$DisableWidgets, [switch]$HideWidgets,
[switch]$HideWidgets, [switch]$DisableChat, [switch]$HideChat,
[switch]$DisableChat,
[switch]$HideChat,
[switch]$ClearStart, [switch]$ClearStart,
[switch]$ClearStartAllUsers, [switch]$ClearStartAllUsers,
[switch]$RevertContextMenu, [switch]$RevertContextMenu,
[switch]$DisableMouseAcceleration,
[switch]$HideHome, [switch]$HideHome,
[switch]$HideGallery, [switch]$HideGallery,
[switch]$ExplorerToHome, [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") { 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-Host "Error: Win11Debloat is unable to run on your system, powershell execution is restricted by security policies" -ForegroundColor Red
Write-Output "" Write-Output ""
@@ -551,13 +550,17 @@ function RestartExplorer {
Write-Output "> Restarting Windows Explorer process to apply all changes... (This may cause some flickering)" 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. # Only restart if the powershell process matches the OS architecture.
# Restarting explorer from a 32bit Powershell window will fail on a 64bit OS # Restarting explorer from a 32bit Powershell window will fail on a 64bit OS
if ([Environment]::Is64BitProcess -eq [Environment]::Is64BitOperatingSystem) { if ([Environment]::Is64BitProcess -eq [Environment]::Is64BitOperatingSystem) {
Stop-Process -processName: Explorer -Force Stop-Process -processName: Explorer -Force
} }
else { 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 {
} }
function DisplayCustomModeOptions {
##################################################################################################################
# #
# 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' {
# Get current Windows build version to compare against features # Get current Windows build version to compare against features
$WinVersion = Get-ItemPropertyValue 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' CurrentBuild $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 # Only show this option for Windows 11 users running build 22621 or later
if ($WinVersion -ge 22621){ if ($WinVersion -ge 22621){
Write-Output "" 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 # Suppress prompt if Silent parameter was passed
if (-not $Silent) { if (-not $Silent) {
Write-Output "" Write-Output ""
@@ -1219,6 +1051,188 @@ if ((-not $global:Params.Count) -or $RunDefaults -or $RunWin11Defaults -or $RunS
} }
PrintHeader 'Custom Mode' 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 # App removal, remove apps based on user selection
@@ -1357,26 +1371,12 @@ else {
RegImport "> Disabling Xbox game/screen recording..." "Disable_DVR.reg" RegImport "> Disabling Xbox game/screen recording..." "Disable_DVR.reg"
continue continue
} }
'ClearStart' {
Write-Output "> Removing all pinned apps from the start menu for user $env:USERNAME..."
ReplaceStartMenu
Write-Output ""
continue
}
'ClearStartAllUsers' {
ReplaceStartMenuForAllUsers
continue
}
'DisableTelemetry' { 'DisableTelemetry' {
RegImport "> Disabling telemetry, diagnostic data, activity history, app-launch tracking and targeted ads..." "Disable_Telemetry.reg" RegImport "> Disabling telemetry, diagnostic data, activity history, app-launch tracking and targeted ads..." "Disable_Telemetry.reg"
continue continue
} }
{$_ -in "DisableBingSearches", "DisableBing"} { {$_ -in "DisableSuggestions", "DisableWindowsSuggestions"} {
RegImport "> Disabling bing web search, bing AI & cortana in Windows search..." "Disable_Bing_Cortana_In_Search.reg" RegImport "> Disabling tips, tricks, suggestions and ads across Windows..." "Disable_Windows_Suggestions.reg"
# Also remove the app package for bing search
$appsList = 'Microsoft.BingSearch'
RemoveApps $appsList
continue continue
} }
'DisableDesktopSpotlight' { 'DisableDesktopSpotlight' {
@@ -1387,14 +1387,48 @@ else {
RegImport "> Disabling tips & tricks on the lockscreen..." "Disable_Lockscreen_Tips.reg" RegImport "> Disabling tips & tricks on the lockscreen..." "Disable_Lockscreen_Tips.reg"
continue continue
} }
{$_ -in "DisableSuggestions", "DisableWindowsSuggestions"} { {$_ -in "DisableBingSearches", "DisableBing"} {
RegImport "> Disabling tips, tricks, suggestions and ads across Windows..." "Disable_Windows_Suggestions.reg" 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 continue
} }
'RevertContextMenu' { 'RevertContextMenu' {
RegImport "> Restoring the old Windows 10 style context menu..." "Disable_Show_More_Options_Context_Menu.reg" RegImport "> Restoring the old Windows 10 style context menu..." "Disable_Show_More_Options_Context_Menu.reg"
continue 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' { 'TaskbarAlignLeft' {
RegImport "> Aligning taskbar buttons to the left..." "Align_Taskbar_Left.reg" 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" RegImport "> Hiding the taskview button from the taskbar..." "Hide_Taskview_Taskbar.reg"
continue 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"} { {$_ -in "HideWidgets", "DisableWidgets"} {
RegImport "> Disabling the widget service and hiding the widget icon from the taskbar..." "Disable_Widgets_Taskbar.reg" RegImport "> Disabling the widget service and hiding the widget icon from the taskbar..." "Disable_Widgets_Taskbar.reg"
continue continue
@@ -1444,22 +1462,6 @@ else {
RegImport "> Hiding the chat icon from the taskbar..." "Disable_Chat_Taskbar.reg" RegImport "> Hiding the chat icon from the taskbar..." "Disable_Chat_Taskbar.reg"
continue 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' { 'ExplorerToHome' {
RegImport "> Changing the default location that File Explorer opens to `Home`..." "Launch_File_Explorer_To_Home.reg" RegImport "> Changing the default location that File Explorer opens to `Home`..." "Launch_File_Explorer_To_Home.reg"
continue continue
@@ -1476,6 +1478,22 @@ else {
RegImport "> Changing the default location that File Explorer opens to `OneDrive`..." "Launch_File_Explorer_To_OneDrive.reg" RegImport "> Changing the default location that File Explorer opens to `OneDrive`..." "Launch_File_Explorer_To_OneDrive.reg"
continue 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' { 'HideDupliDrive' {
RegImport "> Hiding duplicate removable drive entries from the File Explorer navigation pane..." "Hide_duplicate_removable_drives_from_navigation_pane_of_File_Explorer.reg" RegImport "> Hiding duplicate removable drive entries from the File Explorer navigation pane..." "Hide_duplicate_removable_drives_from_navigation_pane_of_File_Explorer.reg"
continue continue