2022-10-04 21:10:29 +02:00
|
|
|
#Requires -RunAsAdministrator
|
|
|
|
|
|
2020-11-07 02:57:38 +01:00
|
|
|
[CmdletBinding(SupportsShouldProcess)]
|
|
|
|
|
param
|
|
|
|
|
(
|
2023-09-27 21:03:25 +02:00
|
|
|
[Parameter(ValueFromPipeline = $true)][switch]$Silent,
|
2023-05-15 16:38:11 -06:00
|
|
|
[Parameter(ValueFromPipeline = $true)][switch]$RunDefaults,
|
|
|
|
|
[Parameter(ValueFromPipeline = $true)][switch]$RunWin11Defaults,
|
|
|
|
|
[Parameter(ValueFromPipeline = $true)][switch]$RemoveApps,
|
2023-08-03 01:18:02 +02:00
|
|
|
[Parameter(ValueFromPipeline = $true)][switch]$RemoveGamingApps,
|
2023-05-15 16:38:11 -06:00
|
|
|
[Parameter(ValueFromPipeline = $true)][switch]$DisableTelemetry,
|
|
|
|
|
[Parameter(ValueFromPipeline = $true)][switch]$DisableBingSearches,
|
|
|
|
|
[Parameter(ValueFromPipeline = $true)][switch]$DisableBing,
|
|
|
|
|
[Parameter(ValueFromPipeline = $true)][switch]$DisableLockscreenTips,
|
|
|
|
|
[Parameter(ValueFromPipeline = $true)][switch]$DisableWindowsSuggestions,
|
|
|
|
|
[Parameter(ValueFromPipeline = $true)][switch]$DisableSuggestions,
|
2023-08-03 20:10:24 +02:00
|
|
|
[Parameter(ValueFromPipeline = $true)][switch]$ShowHiddenFolders,
|
|
|
|
|
[Parameter(ValueFromPipeline = $true)][switch]$ShowKnownFileExt,
|
|
|
|
|
[Parameter(ValueFromPipeline = $true)][switch]$TaskbarAlignLeft,
|
|
|
|
|
[Parameter(ValueFromPipeline = $true)][switch]$HideSearchTb,
|
|
|
|
|
[Parameter(ValueFromPipeline = $true)][switch]$ShowSearchIconTb,
|
|
|
|
|
[Parameter(ValueFromPipeline = $true)][switch]$ShowSearchLabelTb,
|
|
|
|
|
[Parameter(ValueFromPipeline = $true)][switch]$ShowSearchBoxTb,
|
2023-08-07 00:49:41 +02:00
|
|
|
[Parameter(ValueFromPipeline = $true)][switch]$HideTaskview,
|
2023-09-27 02:45:34 +02:00
|
|
|
[Parameter(ValueFromPipeline = $true)][switch]$DisableCopilot,
|
2023-05-15 16:38:11 -06:00
|
|
|
[Parameter(ValueFromPipeline = $true)][switch]$DisableWidgets,
|
2023-07-27 01:09:58 +02:00
|
|
|
[Parameter(ValueFromPipeline = $true)][switch]$HideWidgets,
|
2023-07-18 00:14:06 +02:00
|
|
|
[Parameter(ValueFromPipeline = $true)][switch]$DisableChat,
|
2023-07-27 01:09:58 +02:00
|
|
|
[Parameter(ValueFromPipeline = $true)][switch]$HideChat,
|
2023-09-08 00:47:59 +02:00
|
|
|
[Parameter(ValueFromPipeline = $true)][switch]$ClearStart,
|
2023-05-15 16:38:11 -06:00
|
|
|
[Parameter(ValueFromPipeline = $true)][switch]$DisableOnedrive,
|
2023-07-27 01:09:58 +02:00
|
|
|
[Parameter(ValueFromPipeline = $true)][switch]$HideOnedrive,
|
2023-05-15 16:38:11 -06:00
|
|
|
[Parameter(ValueFromPipeline = $true)][switch]$Disable3dObjects,
|
2023-07-27 01:09:58 +02:00
|
|
|
[Parameter(ValueFromPipeline = $true)][switch]$Hide3dObjects,
|
2023-05-15 16:38:11 -06:00
|
|
|
[Parameter(ValueFromPipeline = $true)][switch]$DisableMusic,
|
2023-07-27 01:09:58 +02:00
|
|
|
[Parameter(ValueFromPipeline = $true)][switch]$HideMusic,
|
2023-05-15 16:38:11 -06:00
|
|
|
[Parameter(ValueFromPipeline = $true)][switch]$DisableIncludeInLibrary,
|
2023-07-27 01:09:58 +02:00
|
|
|
[Parameter(ValueFromPipeline = $true)][switch]$HideIncludeInLibrary,
|
2023-05-15 16:38:11 -06:00
|
|
|
[Parameter(ValueFromPipeline = $true)][switch]$DisableGiveAccessTo,
|
2023-07-27 01:09:58 +02:00
|
|
|
[Parameter(ValueFromPipeline = $true)][switch]$HideGiveAccessTo,
|
|
|
|
|
[Parameter(ValueFromPipeline = $true)][switch]$DisableShare,
|
|
|
|
|
[Parameter(ValueFromPipeline = $true)][switch]$HideShare
|
2020-11-07 02:57:38 +01:00
|
|
|
)
|
|
|
|
|
|
2023-08-03 22:24:27 +02:00
|
|
|
|
|
|
|
|
# Reads list of apps from file and removes them for all user accounts and from the OS image.
|
2023-05-15 16:38:11 -06:00
|
|
|
function RemoveApps {
|
2023-08-03 01:18:02 +02:00
|
|
|
param(
|
|
|
|
|
$appsFile,
|
|
|
|
|
$message
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
Write-Output $message
|
2020-10-27 23:26:39 +01:00
|
|
|
|
2023-08-03 22:24:27 +02:00
|
|
|
# Get list of apps from file at the path provided, and remove them one by one
|
2023-08-02 21:58:09 +02:00
|
|
|
Foreach ($app in (Get-Content -Path $appsFile | Where-Object { $_ -notmatch '^#.*' -and $_ -notmatch '^\s*$' } ))
|
|
|
|
|
{
|
2023-08-03 22:24:27 +02:00
|
|
|
# Remove any spaces before and after the Appname
|
2023-08-02 21:58:09 +02:00
|
|
|
$app = $app.Trim()
|
2023-07-18 16:03:22 +02:00
|
|
|
|
2023-08-03 22:24:27 +02:00
|
|
|
# Remove any comments from the Appname
|
2023-08-02 21:58:09 +02:00
|
|
|
if (-Not ($app.IndexOf('#') -eq -1)) {
|
|
|
|
|
$app = $app.Substring(0, $app.IndexOf('#'))
|
|
|
|
|
}
|
2023-08-03 22:24:27 +02:00
|
|
|
# Remove any remaining spaces from the Appname
|
2023-08-02 21:58:09 +02:00
|
|
|
if (-Not ($app.IndexOf(' ') -eq -1)) {
|
|
|
|
|
$app = $app.Substring(0, $app.IndexOf(' '))
|
|
|
|
|
}
|
2020-11-02 20:01:00 +01:00
|
|
|
|
2023-08-03 22:40:19 +02:00
|
|
|
$appString = $app.Trim('*')
|
|
|
|
|
Write-Output "Attempting to remove $appString..."
|
2020-10-27 23:26:39 +01:00
|
|
|
|
2023-08-03 22:24:27 +02:00
|
|
|
# Remove installed app for all existing users
|
2020-10-27 23:26:39 +01:00
|
|
|
Get-AppxPackage -Name $app -AllUsers | Remove-AppxPackage
|
2023-02-05 22:28:41 +01:00
|
|
|
|
2023-08-03 22:24:27 +02:00
|
|
|
# Remove provisioned app from OS image, so the app won't be installed for any new users
|
2023-05-15 16:38:11 -06:00
|
|
|
Get-AppxProvisionedPackage -Online | Where-Object { $_.PackageName -like $app } | ForEach-Object { Remove-ProvisionedAppxPackage -Online -AllUsers -PackageName $_.PackageName }
|
2020-10-27 23:26:39 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-03 22:24:27 +02:00
|
|
|
|
2022-04-09 18:52:16 +02:00
|
|
|
# Import & execute regfile
|
2023-05-15 16:38:11 -06:00
|
|
|
function RegImport {
|
2020-11-07 02:57:38 +01:00
|
|
|
param
|
|
|
|
|
(
|
|
|
|
|
$Message,
|
|
|
|
|
$Path
|
|
|
|
|
)
|
2020-11-04 01:48:42 +01:00
|
|
|
|
2020-11-07 02:57:38 +01:00
|
|
|
Write-Output $Message
|
|
|
|
|
reg import $path
|
2020-11-04 01:48:42 +01:00
|
|
|
}
|
|
|
|
|
|
2023-08-03 22:24:27 +02:00
|
|
|
|
2023-09-08 00:47:59 +02:00
|
|
|
# Stop & Restart the windows explorer process
|
|
|
|
|
function RestartExplorer {
|
|
|
|
|
Write-Output "> Restarting windows explorer to apply all changes."
|
|
|
|
|
|
|
|
|
|
Start-Sleep 0.5
|
|
|
|
|
|
|
|
|
|
taskkill /f /im explorer.exe
|
|
|
|
|
|
|
|
|
|
Start-Process explorer.exe
|
|
|
|
|
|
|
|
|
|
Write-Output ""
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Clear all pinned apps from the start menu.
|
|
|
|
|
# Credit: https://lazyadmin.nl/win-11/customize-windows-11-start-menu-layout/
|
|
|
|
|
function ClearStartMenu {
|
|
|
|
|
param(
|
|
|
|
|
$message
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
Write-Output $message
|
|
|
|
|
|
|
|
|
|
# Path to start menu template
|
2023-09-08 01:06:01 +02:00
|
|
|
$startmenuTemplate = "$PSScriptRoot/Start/start2.bin"
|
2023-09-08 00:47:59 +02:00
|
|
|
|
|
|
|
|
# Get all user profile folders
|
|
|
|
|
$usersStartMenu = get-childitem -path "C:\Users\*\AppData\Local\Packages\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\LocalState"
|
|
|
|
|
|
|
|
|
|
# Copy Start menu to all users folders
|
|
|
|
|
ForEach ($startmenu in $usersStartMenu) {
|
|
|
|
|
$startmenuBinFile = $startmenu.Fullname + "\start2.bin"
|
|
|
|
|
|
|
|
|
|
# Check if bin file exists
|
|
|
|
|
if(Test-Path $startmenuBinFile) {
|
|
|
|
|
Copy-Item -Path $startmenuTemplate -Destination $startmenu -Force
|
2023-09-12 02:59:25 +02:00
|
|
|
|
|
|
|
|
$cpyMsg = "Replaced start menu for user " + $startmenu.Fullname.Split("\")[2]
|
|
|
|
|
Write-Output $cpyMsg
|
2023-09-08 00:47:59 +02:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
# Bin file doesn't exist, indicating the user is not running the correct version of windows. Exit function
|
2023-09-12 02:59:25 +02:00
|
|
|
Write-Output "Error: Start menu file not found. Please make sure you're running Windows 11 22H2 or later"
|
2023-09-08 00:47:59 +02:00
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Also apply start menu template to the default profile
|
|
|
|
|
|
|
|
|
|
# Path to default profile
|
|
|
|
|
$defaultProfile = "C:\Users\default\AppData\Local\Packages\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\LocalState"
|
|
|
|
|
|
|
|
|
|
# Create folder if it doesn't exist
|
2023-09-27 21:03:25 +02:00
|
|
|
if(-Not(Test-Path $defaultProfile)) {
|
2023-09-12 02:59:25 +02:00
|
|
|
new-item $defaultProfile -ItemType Directory -Force | Out-Null
|
|
|
|
|
Write-Output "Created LocalState folder for default user"
|
2023-09-08 00:47:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Copy template to default profile
|
|
|
|
|
Copy-Item -Path $startmenuTemplate -Destination $defaultProfile -Force
|
2023-09-12 02:59:25 +02:00
|
|
|
Write-Output "Copied start menu template to default user folder"
|
2023-09-08 00:47:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2023-09-28 16:11:04 +02:00
|
|
|
$SPParams = 'WhatIf', 'Confirm', 'Verbose', 'Silent'
|
2023-09-27 21:03:25 +02:00
|
|
|
$SPParamCount = 0
|
|
|
|
|
|
|
|
|
|
foreach ($param in $SPParams) {
|
|
|
|
|
if ($PSBoundParameters.ContainsKey($param)) {
|
|
|
|
|
$SPParamCount++
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-07 00:49:41 +02:00
|
|
|
# Change script execution based on provided parameters or user input
|
2023-09-27 21:03:25 +02:00
|
|
|
if ((-Not $PSBoundParameters.Count) -or $RunDefaults -or $RunWin11Defaults -or ($SPParamCount -eq $PSBoundParameters.Count)) {
|
2023-08-03 01:18:02 +02:00
|
|
|
if ($RunDefaults -or $RunWin11Defaults) {
|
2020-11-07 02:57:38 +01:00
|
|
|
$Mode = '1';
|
|
|
|
|
}
|
2023-05-15 16:38:11 -06:00
|
|
|
else {
|
2023-08-03 22:24:27 +02:00
|
|
|
# Show menu and wait for user input, loops until valid input is provided
|
2022-09-08 17:20:53 +02:00
|
|
|
Do {
|
2023-05-15 16:38:11 -06:00
|
|
|
Clear-Host
|
2023-08-03 22:24:27 +02:00
|
|
|
|
|
|
|
|
# Get & print script menu from file
|
|
|
|
|
Foreach ($line in (Get-Content -Path "$PSScriptRoot/Menus/Menu.txt" )) {
|
|
|
|
|
Write-Output $line
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-03 01:18:02 +02:00
|
|
|
$Mode = Read-Host "Please select an option (1/2/0)"
|
2020-11-07 02:57:38 +01:00
|
|
|
|
2023-09-28 16:11:04 +02:00
|
|
|
# Show information based on user input, Suppress user prompt if Silent parameter was passed
|
2023-05-15 16:38:11 -06:00
|
|
|
if ($Mode -eq '0') {
|
|
|
|
|
Clear-Host
|
2023-08-03 22:24:27 +02:00
|
|
|
|
|
|
|
|
# Get & print script information from file
|
|
|
|
|
Foreach ($line in (Get-Content -Path "$PSScriptRoot/Menus/Info.txt" )) {
|
|
|
|
|
Write-Output $line
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-08 17:20:53 +02:00
|
|
|
Write-Output "Press any key to go back..."
|
|
|
|
|
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
|
|
|
|
|
}
|
2023-09-28 16:11:04 +02:00
|
|
|
elseif (-Not $Silent -and ($Mode -eq '1')) {
|
2023-08-03 22:24:27 +02:00
|
|
|
Clear-Host
|
|
|
|
|
|
|
|
|
|
# Get & print default settings info from file
|
|
|
|
|
Foreach ($line in (Get-Content -Path "$PSScriptRoot/Menus/DefaultSettings.txt" )) {
|
|
|
|
|
Write-Output $line
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Write-Output "Press any key to start..."
|
|
|
|
|
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
|
|
|
|
|
}
|
2022-09-08 17:20:53 +02:00
|
|
|
}
|
2023-08-03 01:18:02 +02:00
|
|
|
while ($Mode -ne '1' -and $Mode -ne '2')
|
2020-11-07 02:57:38 +01:00
|
|
|
}
|
2020-11-06 12:48:13 +01:00
|
|
|
|
2022-04-09 18:52:16 +02:00
|
|
|
# Add execution parameters based on the mode
|
2023-05-15 16:38:11 -06:00
|
|
|
switch ($Mode) {
|
2023-08-03 22:24:27 +02:00
|
|
|
# Default mode, no user input required, all (relevant) options are added
|
2023-05-15 16:38:11 -06:00
|
|
|
'1' {
|
|
|
|
|
Clear-Host
|
2020-11-07 02:57:38 +01:00
|
|
|
Write-Output "-------------------------------------------------------------------------------------------"
|
2023-09-08 01:06:01 +02:00
|
|
|
Write-Output " Win11Debloat Script - Default Configuration"
|
2020-11-07 02:57:38 +01:00
|
|
|
Write-Output "-------------------------------------------------------------------------------------------"
|
|
|
|
|
$PSBoundParameters.Add('RemoveApps', $RemoveApps)
|
2022-08-29 16:14:36 +02:00
|
|
|
$PSBoundParameters.Add('DisableTelemetry', $DisableTelemetry)
|
2022-09-08 16:38:14 +02:00
|
|
|
$PSBoundParameters.Add('DisableBing', $DisableBing)
|
2020-11-07 02:57:38 +01:00
|
|
|
$PSBoundParameters.Add('DisableLockscreenTips', $DisableLockscreenTips)
|
2023-04-24 15:30:25 +02:00
|
|
|
$PSBoundParameters.Add('DisableSuggestions', $DisableSuggestions)
|
2023-08-03 20:10:24 +02:00
|
|
|
$PSBoundParameters.Add('ShowKnownFileExt', $ShowKnownFileExt)
|
2022-08-29 19:26:13 +02:00
|
|
|
$PSBoundParameters.Add('DisableWidgets', $DisableWidgets)
|
2023-07-27 01:09:58 +02:00
|
|
|
$PSBoundParameters.Add('HideChat', $HideChat)
|
2022-09-08 17:20:53 +02:00
|
|
|
|
2023-08-03 22:24:27 +02:00
|
|
|
# Only add this option for windows 10 users
|
2023-08-03 01:18:02 +02:00
|
|
|
if (get-ciminstance -query "select caption from win32_operatingsystem where caption like '%Windows 10%'"){
|
|
|
|
|
$PSBoundParameters.Add('Hide3dObjects', $Hide3dObjects)
|
|
|
|
|
}
|
2021-12-15 21:45:48 +01:00
|
|
|
}
|
2022-09-08 17:20:53 +02:00
|
|
|
|
2023-08-03 22:24:27 +02:00
|
|
|
# Custom mode, add options based on user input
|
2023-08-03 01:18:02 +02:00
|
|
|
'2' {
|
2023-05-15 16:38:11 -06:00
|
|
|
Clear-Host
|
2020-11-07 02:57:38 +01:00
|
|
|
Write-Output "-------------------------------------------------------------------------------------------"
|
2023-07-26 23:54:02 +02:00
|
|
|
Write-Output " Win11Debloat Script - Custom Configuration"
|
2020-11-07 02:57:38 +01:00
|
|
|
Write-Output "-------------------------------------------------------------------------------------------"
|
|
|
|
|
|
2023-09-08 01:06:01 +02:00
|
|
|
if ($( Read-Host -Prompt "Remove pre-installed bloatware apps? (y/n)" ) -eq 'y') {
|
2020-11-07 02:57:38 +01:00
|
|
|
$PSBoundParameters.Add('RemoveApps', $RemoveApps)
|
2023-08-03 01:18:02 +02:00
|
|
|
|
|
|
|
|
Write-Output ""
|
|
|
|
|
|
|
|
|
|
if ($( Read-Host -Prompt " Also remove gaming-related apps such as the Xbox App and Xbox Gamebar? (y/n)" ) -eq 'y') {
|
|
|
|
|
$PSBoundParameters.Add('RemoveGamingApps', $RemoveGamingApps)
|
|
|
|
|
}
|
2020-11-07 02:57:38 +01:00
|
|
|
}
|
|
|
|
|
|
2023-07-18 00:14:06 +02:00
|
|
|
Write-Output ""
|
|
|
|
|
|
2023-08-07 01:23:55 +02:00
|
|
|
if ($( Read-Host -Prompt "Disable telemetry, diagnostic data, app-launch tracking and targeted ads? (y/n)" ) -eq 'y') {
|
2022-08-29 16:14:36 +02:00
|
|
|
$PSBoundParameters.Add('DisableTelemetry', $DisableTelemetry)
|
2020-11-07 02:57:38 +01:00
|
|
|
}
|
|
|
|
|
|
2023-07-18 00:14:06 +02:00
|
|
|
Write-Output ""
|
|
|
|
|
|
2023-06-01 11:49:16 +02:00
|
|
|
if ($( Read-Host -Prompt "Disable bing search, bing AI & cortana in windows search? (y/n)" ) -eq 'y') {
|
2022-09-08 16:38:14 +02:00
|
|
|
$PSBoundParameters.Add('DisableBing', $DisableBing)
|
2020-11-07 02:57:38 +01:00
|
|
|
}
|
|
|
|
|
|
2023-07-18 00:14:06 +02:00
|
|
|
Write-Output ""
|
|
|
|
|
|
2023-09-27 21:03:25 +02:00
|
|
|
if ($( Read-Host -Prompt "Disable tips, tricks, suggestions and ads in start, settings, notifications, explorer and lockscreen? (y/n)" ) -eq 'y') {
|
2023-08-03 20:10:24 +02:00
|
|
|
$PSBoundParameters.Add('DisableSuggestions', $DisableSuggestions)
|
2023-09-27 02:45:34 +02:00
|
|
|
$PSBoundParameters.Add('DisableLockscreenTips', $DisableLockscreenTips)
|
2023-08-03 20:10:24 +02:00
|
|
|
}
|
2020-11-07 02:57:38 +01:00
|
|
|
|
2023-07-18 00:14:06 +02:00
|
|
|
Write-Output ""
|
|
|
|
|
|
2023-09-08 00:47:59 +02:00
|
|
|
# Only show this option for windows 11 users
|
|
|
|
|
if (get-ciminstance -query "select caption from win32_operatingsystem where caption like '%Windows 11%'"){
|
2023-09-27 21:03:25 +02:00
|
|
|
if ($( Read-Host -Prompt "Remove all pinned apps from the start menu? This applies to all existing and new users and can't be reverted (y/n)" ) -eq 'y') {
|
2023-09-08 00:47:59 +02:00
|
|
|
$PSBoundParameters.Add('ClearStart', $ClearStart)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Write-Output ""
|
|
|
|
|
|
2023-09-27 02:45:34 +02:00
|
|
|
if ($( Read-Host -Prompt "Do you want to make any changes to the taskbar and related services? (y/n)" ) -eq 'y') {
|
2023-08-03 22:24:27 +02:00
|
|
|
# Only show these specific options for windows 11 users
|
2023-07-18 00:14:06 +02:00
|
|
|
if (get-ciminstance -query "select caption from win32_operatingsystem where caption like '%Windows 11%'"){
|
|
|
|
|
Write-Output ""
|
|
|
|
|
|
|
|
|
|
if ($( Read-Host -Prompt " Align taskbar buttons to left side? (y/n)" ) -eq 'y') {
|
|
|
|
|
$PSBoundParameters.Add('TaskbarAlignLeft', $TaskbarAlignLeft)
|
|
|
|
|
}
|
2023-08-03 20:10:24 +02:00
|
|
|
|
2023-08-07 00:49:41 +02:00
|
|
|
# Show options for search icon on taskbar, only continue on valid input
|
2023-08-03 20:10:24 +02:00
|
|
|
Do {
|
|
|
|
|
Write-Output ""
|
|
|
|
|
Write-Output " Options:"
|
|
|
|
|
Write-Output " (0) No change"
|
|
|
|
|
Write-Output " (1) Hide search icon from the taskbar"
|
|
|
|
|
Write-Output " (2) Show search icon on the taskbar"
|
|
|
|
|
Write-Output " (3) Show search icon with label on the taskbar"
|
|
|
|
|
Write-Output " (4) Show search box on the taskbar"
|
|
|
|
|
$TbSearchInput = Read-Host " Hide or change the search icon on the taskbar? (0/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' {
|
|
|
|
|
$PSBoundParameters.Add('HideSearchTb', $HideSearchTb)
|
|
|
|
|
}
|
|
|
|
|
'2' {
|
|
|
|
|
$PSBoundParameters.Add('ShowSearchIconTb', $ShowSearchIconTb)
|
|
|
|
|
}
|
|
|
|
|
'3' {
|
|
|
|
|
$PSBoundParameters.Add('ShowSearchLabelTb', $ShowSearchLabelTb)
|
|
|
|
|
}
|
|
|
|
|
'4' {
|
|
|
|
|
$PSBoundParameters.Add('ShowSearchBoxTb', $ShowSearchBoxTb)
|
|
|
|
|
}
|
2023-08-07 00:49:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Write-Output ""
|
2023-08-03 20:10:24 +02:00
|
|
|
|
2023-08-07 00:49:41 +02:00
|
|
|
if ($( Read-Host -Prompt " Hide the taskview button from the taskbar? (y/n)" ) -eq 'y') {
|
|
|
|
|
$PSBoundParameters.Add('HideTaskview', $HideTaskview)
|
2023-08-03 20:10:24 +02:00
|
|
|
}
|
2023-09-27 02:45:34 +02:00
|
|
|
|
|
|
|
|
Write-Output ""
|
|
|
|
|
|
|
|
|
|
if ($( Read-Host -Prompt " Disable Windows copilot and hide it from the taskbar? (y/n)" ) -eq 'y') {
|
|
|
|
|
$PSBoundParameters.Add('DisableCopilot', $DisableCopilot)
|
|
|
|
|
}
|
2022-08-29 19:26:13 +02:00
|
|
|
}
|
|
|
|
|
|
2023-07-18 00:14:06 +02:00
|
|
|
Write-Output ""
|
|
|
|
|
|
2023-08-03 20:10:24 +02:00
|
|
|
if ($( Read-Host -Prompt " Disable the widgets service and hide the widget (news and interests) icon from the taskbar? (y/n)" ) -eq 'y') {
|
2022-08-29 19:26:13 +02:00
|
|
|
$PSBoundParameters.Add('DisableWidgets', $DisableWidgets)
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-18 00:14:06 +02:00
|
|
|
Write-Output ""
|
|
|
|
|
|
2023-08-03 20:10:24 +02:00
|
|
|
if ($( Read-Host -Prompt " Hide the chat (meet now) icon from the taskbar? (y/n)" ) -eq 'y') {
|
2023-07-27 01:09:58 +02:00
|
|
|
$PSBoundParameters.Add('HideChat', $HideChat)
|
2022-08-29 16:14:36 +02:00
|
|
|
}
|
2023-07-18 00:14:06 +02:00
|
|
|
}
|
|
|
|
|
|
2023-08-03 22:24:27 +02:00
|
|
|
Write-Output ""
|
|
|
|
|
|
2023-08-03 20:10:24 +02:00
|
|
|
if ($( Read-Host -Prompt "Do you want to make any changes to windows explorer? (y/n)" ) -eq 'y') {
|
|
|
|
|
Write-Output ""
|
|
|
|
|
|
|
|
|
|
if ($( Read-Host -Prompt " Show hidden files, folders and drives? (y/n)" ) -eq 'y') {
|
|
|
|
|
$PSBoundParameters.Add('ShowHiddenFolders', $ShowHiddenFolders)
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-03 22:24:27 +02:00
|
|
|
Write-Output ""
|
|
|
|
|
|
2023-08-03 20:10:24 +02:00
|
|
|
if ($( Read-Host -Prompt " Show file extensions for known file types? (y/n)" ) -eq 'y') {
|
|
|
|
|
$PSBoundParameters.Add('ShowKnownFileExt', $ShowKnownFileExt)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-03 01:18:02 +02:00
|
|
|
# Only show option for disabling these specific folders for windows 10 users
|
2023-07-18 00:14:06 +02:00
|
|
|
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 windows explorer sidepanel? (y/n)" ) -eq 'y') {
|
|
|
|
|
Write-Output ""
|
|
|
|
|
|
|
|
|
|
if ($( Read-Host -Prompt " Hide the onedrive folder in windows explorer? (y/n)" ) -eq 'y') {
|
2023-07-27 01:09:58 +02:00
|
|
|
$PSBoundParameters.Add('HideOnedrive', $HideOnedrive)
|
2023-07-18 00:14:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Write-Output ""
|
|
|
|
|
|
|
|
|
|
if ($( Read-Host -Prompt " Hide the 3D objects folder in windows explorer? (y/n)" ) -eq 'y') {
|
2023-07-27 01:09:58 +02:00
|
|
|
$PSBoundParameters.Add('Hide3dObjects', $Hide3dObjects)
|
2023-06-01 11:49:16 +02:00
|
|
|
}
|
2023-07-18 00:14:06 +02:00
|
|
|
|
|
|
|
|
Write-Output ""
|
2022-08-29 16:14:36 +02:00
|
|
|
|
2023-07-18 00:14:06 +02:00
|
|
|
if ($( Read-Host -Prompt " Hide the music folder in windows explorer? (y/n)" ) -eq 'y') {
|
2023-07-27 01:09:58 +02:00
|
|
|
$PSBoundParameters.Add('HideMusic', $HideMusic)
|
2023-06-01 11:49:16 +02:00
|
|
|
}
|
2022-08-29 16:14:36 +02:00
|
|
|
}
|
2020-11-07 02:57:38 +01:00
|
|
|
}
|
|
|
|
|
|
2023-08-03 01:18:02 +02:00
|
|
|
# Only show option for disabling context menu items for windows 10 users
|
2023-06-01 11:49:16 +02:00
|
|
|
if (get-ciminstance -query "select caption from win32_operatingsystem where caption like '%Windows 10%'"){
|
2023-07-18 00:14:06 +02:00
|
|
|
Write-Output ""
|
|
|
|
|
|
2023-06-01 11:49:16 +02:00
|
|
|
if ($( Read-Host -Prompt "Do you want to disable any context menu options? (y/n)" ) -eq 'y') {
|
2023-07-18 00:14:06 +02:00
|
|
|
Write-Output ""
|
|
|
|
|
|
2023-07-27 01:09:58 +02:00
|
|
|
if ($( Read-Host -Prompt " Hide the 'Include in library' option in the context menu? (y/n)" ) -eq 'y') {
|
|
|
|
|
$PSBoundParameters.Add('HideIncludeInLibrary', $HideIncludeInLibrary)
|
2023-06-01 11:49:16 +02:00
|
|
|
}
|
2022-08-29 16:14:36 +02:00
|
|
|
|
2023-07-18 00:14:06 +02:00
|
|
|
Write-Output ""
|
|
|
|
|
|
2023-07-27 01:09:58 +02:00
|
|
|
if ($( Read-Host -Prompt " Hide the 'Give access to' option in the context menu? (y/n)" ) -eq 'y') {
|
|
|
|
|
$PSBoundParameters.Add('HideGiveAccessTo', $HideGiveAccessTo)
|
2023-06-01 11:49:16 +02:00
|
|
|
}
|
2022-08-29 16:14:36 +02:00
|
|
|
|
2023-07-18 00:14:06 +02:00
|
|
|
Write-Output ""
|
|
|
|
|
|
2023-07-27 01:09:58 +02:00
|
|
|
if ($( Read-Host -Prompt " Hide the 'Share' option in the context menu? (y/n)" ) -eq 'y') {
|
|
|
|
|
$PSBoundParameters.Add('HideShare', $HideShare)
|
2023-06-01 11:49:16 +02:00
|
|
|
}
|
2022-08-29 16:14:36 +02:00
|
|
|
}
|
2020-11-07 02:57:38 +01:00
|
|
|
}
|
|
|
|
|
|
2023-09-28 16:11:04 +02:00
|
|
|
# Suppress prompt if Silent parameter was passed
|
|
|
|
|
if (-Not $Silent) {
|
|
|
|
|
Write-Output ""
|
|
|
|
|
Write-Output ""
|
|
|
|
|
Write-Output ""
|
|
|
|
|
Write-Output "Press any key to confirm your choices and execute the script..."
|
|
|
|
|
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
|
|
|
|
|
}
|
2023-09-27 21:03:25 +02:00
|
|
|
|
2023-08-03 22:40:19 +02:00
|
|
|
Clear-Host
|
|
|
|
|
Write-Output "-------------------------------------------------------------------------------------------"
|
|
|
|
|
Write-Output " Win11Debloat Script - Custom Configuration"
|
|
|
|
|
Write-Output "-------------------------------------------------------------------------------------------"
|
2020-11-07 02:57:38 +01:00
|
|
|
}
|
|
|
|
|
}
|
2020-11-06 12:48:13 +01:00
|
|
|
}
|
2023-05-15 16:38:11 -06:00
|
|
|
else {
|
|
|
|
|
Clear-Host
|
2020-11-07 02:57:38 +01:00
|
|
|
Write-Output "-------------------------------------------------------------------------------------------"
|
2023-07-26 23:54:02 +02:00
|
|
|
Write-Output " Win11Debloat Script - Custom Configuration"
|
2020-11-07 02:57:38 +01:00
|
|
|
Write-Output "-------------------------------------------------------------------------------------------"
|
2020-11-06 12:48:13 +01:00
|
|
|
}
|
|
|
|
|
|
2023-08-03 22:24:27 +02:00
|
|
|
|
2023-09-28 16:11:04 +02:00
|
|
|
if ($SPParamCount -eq $PSBoundParameters.Keys.Count) {
|
|
|
|
|
Write-Output "The script completed without making any changes."
|
|
|
|
|
|
|
|
|
|
# Suppress prompt if Silent parameter was passed
|
|
|
|
|
if(-Not $Silent) {
|
2023-07-27 01:09:58 +02:00
|
|
|
Write-Output ""
|
2023-09-28 16:11:04 +02:00
|
|
|
Write-Output "Press any key to exit..."
|
|
|
|
|
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
|
2020-11-07 02:57:38 +01:00
|
|
|
}
|
2020-10-27 23:26:39 +01:00
|
|
|
}
|
2023-09-28 16:11:04 +02:00
|
|
|
else {
|
|
|
|
|
# Execute all selected/provided parameters
|
|
|
|
|
switch ($PSBoundParameters.Keys) {
|
|
|
|
|
'RemoveApps' {
|
|
|
|
|
RemoveApps "$PSScriptRoot/Appslist.txt" "> Removing pre-installed windows apps..."
|
|
|
|
|
Write-Output ""
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
'RemoveGamingApps' {
|
|
|
|
|
RemoveApps "$PSScriptRoot/GamingAppslist.txt" "> Removing gaming-related windows apps..."
|
|
|
|
|
Write-Output ""
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
'DisableTelemetry' {
|
|
|
|
|
RegImport "> Disabling telemetry, diagnostic data, app-launch tracking and targeted ads..." $PSScriptRoot\Regfiles\Disable_Telemetry.reg
|
|
|
|
|
Write-Output ""
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
{$_ -in "DisableBingSearches", "DisableBing"} {
|
|
|
|
|
RegImport "> Disabling bing search, bing AI & cortana in windows search..." $PSScriptRoot\Regfiles\Disable_Bing_Cortana_In_Search.reg
|
|
|
|
|
Write-Output ""
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
'DisableLockscreenTips' {
|
|
|
|
|
RegImport "> Disabling tips & tricks on the lockscreen..." $PSScriptRoot\Regfiles\Disable_Lockscreen_Tips.reg
|
|
|
|
|
Write-Output ""
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
{$_ -in "DisableSuggestions", "DisableWindowsSuggestions"} {
|
|
|
|
|
RegImport "> Disabling tips, tricks, suggestions and ads across Windows..." $PSScriptRoot\Regfiles\Disable_Windows_Suggestions.reg
|
|
|
|
|
Write-Output ""
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
'TaskbarAlignLeft' {
|
|
|
|
|
RegImport "> Aligning taskbar buttons to the left..." $PSScriptRoot\Regfiles\Align_Taskbar_Left.reg
|
|
|
|
|
Write-Output ""
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
'HideSearchTb' {
|
|
|
|
|
RegImport "> Hiding the search icon from the taskbar..." $PSScriptRoot\Regfiles\Hide_Search_Taskbar.reg
|
|
|
|
|
Write-Output ""
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
'ShowSearchIconTb' {
|
|
|
|
|
RegImport "> Changing taskbar search to icon only..." $PSScriptRoot\Regfiles\Show_Search_Icon.reg
|
|
|
|
|
Write-Output ""
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
'ShowSearchLabelTb' {
|
|
|
|
|
RegImport "> Changing taskbar search to icon with label..." $PSScriptRoot\Regfiles\Show_Search_Icon_And_Label.reg
|
|
|
|
|
Write-Output ""
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
'ShowSearchBoxTb' {
|
|
|
|
|
RegImport "> Changing taskbar search to search box..." $PSScriptRoot\Regfiles\Show_Search_Box.reg
|
|
|
|
|
Write-Output ""
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
'HideTaskview' {
|
|
|
|
|
RegImport "> Hiding the taskview button from the taskbar..." $PSScriptRoot\Regfiles\Hide_Taskview_Taskbar.reg
|
|
|
|
|
Write-Output ""
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
'DisableCopilot' {
|
|
|
|
|
RegImport "> Disabling Windows copilot..." $PSScriptRoot\Regfiles\Disable_Copilot.reg
|
|
|
|
|
Write-Output ""
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
{$_ -in "HideWidgets", "DisableWidgets"} {
|
|
|
|
|
RegImport "> Disabling the widget service and hiding the widget icon from the taskbar..." $PSScriptRoot\Regfiles\Disable_Widgets_Taskbar.reg
|
|
|
|
|
Write-Output ""
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
{$_ -in "HideChat", "DisableChat"} {
|
|
|
|
|
RegImport "> Hiding the chat icon from the taskbar..." $PSScriptRoot\Regfiles\Disable_Chat_Taskbar.reg
|
|
|
|
|
Write-Output ""
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
'ClearStart' {
|
|
|
|
|
ClearStartMenu "> Removing all pinned apps from the start menu..."
|
|
|
|
|
Write-Output ""
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
'ShowHiddenFolders' {
|
|
|
|
|
RegImport "> Unhiding hidden files, folders and drives..." $PSScriptRoot\Regfiles\Show_Hidden_Folders.reg
|
|
|
|
|
Write-Output ""
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
'ShowKnownFileExt' {
|
|
|
|
|
RegImport "> Enabling file extensions for known file types..." $PSScriptRoot\Regfiles\Show_Extensions_For_Known_File_Types.reg
|
|
|
|
|
Write-Output ""
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
{$_ -in "HideOnedrive", "DisableOnedrive"} {
|
|
|
|
|
RegImport "> Hiding the onedrive folder in windows explorer..." $PSScriptRoot\Regfiles\Hide_Onedrive_Folder.reg
|
|
|
|
|
Write-Output ""
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
{$_ -in "Hide3dObjects", "Disable3dObjects"} {
|
|
|
|
|
RegImport "> Hiding the 3D objects folder in windows explorer..." $PSScriptRoot\Regfiles\Hide_3D_Objects_Folder.reg
|
|
|
|
|
Write-Output ""
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
{$_ -in "HideMusic", "DisableMusic"} {
|
|
|
|
|
RegImport "> Hiding the music folder in windows explorer..." $PSScriptRoot\Regfiles\Hide_Music_folder.reg
|
|
|
|
|
Write-Output ""
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
{$_ -in "HideIncludeInLibrary", "DisableIncludeInLibrary"} {
|
|
|
|
|
RegImport "> Hiding 'Include in library' in the context menu..." $PSScriptRoot\Regfiles\Disable_Include_in_library_from_context_menu.reg
|
|
|
|
|
Write-Output ""
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
{$_ -in "HideGiveAccessTo", "DisableGiveAccessTo"} {
|
|
|
|
|
RegImport "> Hiding 'Give access to' in the context menu..." $PSScriptRoot\Regfiles\Disable_Give_access_to_context_menu.reg
|
|
|
|
|
Write-Output ""
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
{$_ -in "HideShare", "DisableShare"} {
|
|
|
|
|
RegImport "> Hiding 'Share' in the context menu..." $PSScriptRoot\Regfiles\Disable_Share_from_context_menu.reg
|
|
|
|
|
Write-Output ""
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-10-27 23:26:39 +01:00
|
|
|
|
2023-09-28 16:11:04 +02:00
|
|
|
RestartExplorer
|
2023-09-27 21:03:25 +02:00
|
|
|
|
|
|
|
|
Write-Output ""
|
2023-09-28 16:11:04 +02:00
|
|
|
Write-Output ""
|
|
|
|
|
Write-Output "Script completed successfully!"
|
2023-09-27 21:03:25 +02:00
|
|
|
|
2023-09-28 16:11:04 +02:00
|
|
|
# Suppress prompt if Silent parameter was passed
|
|
|
|
|
if(-Not $Silent) {
|
|
|
|
|
Write-Output ""
|
|
|
|
|
Write-Output "Press any key to exit..."
|
|
|
|
|
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
|
|
|
|
|
}
|
|
|
|
|
}
|