From 6bbe9fe55d74a9985e99c31508d40c9955c35ac3 Mon Sep 17 00:00:00 2001 From: Raphire <9938813+Raphire@users.noreply.github.com> Date: Fri, 8 Sep 2023 00:47:59 +0200 Subject: [PATCH] Added option to clear pinned apps in the start menu (#7) The script now automatically restarts windows explorer to apply all changes --- README.md | 14 +++++---- Start/start2.bin | Bin 0 -> 972 bytes Win11Debloat.ps1 | 79 +++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 85 insertions(+), 8 deletions(-) create mode 100644 Start/start2.bin diff --git a/README.md b/README.md index 0b5e0b2..652e2a3 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ In this mode you'll be able to make any of the following changes: - Disable tips, tricks and suggestions in the start menu and settings, and sync provider ads in windows explorer. - Show hidden files, folders and drives. - Show file extensions for known file types. +- Remove all pinned apps from the start menu (Windows 11 update 22H2 or later only) - Align taskbar icons to the left. (Windows 11 only) - Hide or change the search icon/box on the taskbar. (Windows 11 only) - Hide the taskview button from the taskbar. (Windows 11 only) @@ -86,12 +87,13 @@ To run the script without any user input, simply add parameters at the end, exam | -ShowSearchBoxTb | Show search box on the taskbar. (Windows 11 only) | | -DisableWidgets | Disable the widget service & hide the widget (news and interests) icon from the taskbar. | | -HideChat | Hide the chat (meet now) icon from the taskbar. | -| -HideOnedrive | Hide the onedrive folder in the windows explorer sidepanel. | -| -Hide3dObjects | Hide the 3D objects folder under 'This pc' in windows explorer. | -| -HideMusic | Hide the music folder under 'This pc' in windows explorer. | -| -HideIncludeInLibrary | Hide the 'Include in library' option in the context menu. | -| -HideGiveAccessTo | Hide the 'Give access to' option in the context menu. | -| -HideShare | Hide the 'Share' option in the context menu. | +| -ClearStart | Remove all pinned apps from the start menu. (Windows 11 update 22H2 or later only) | +| -HideOnedrive | Hide the onedrive folder in the windows explorer sidepanel. (Windows 10 only) | +| -Hide3dObjects | Hide the 3D objects folder under 'This pc' in windows explorer. (Windows 10 only) | +| -HideMusic | Hide the music folder under 'This pc' in windows explorer. (Windows 10 only) | +| -HideIncludeInLibrary | Hide the 'Include in library' option in the context menu. (Windows 10 only) | +| -HideGiveAccessTo | Hide the 'Give access to' option in the context menu. (Windows 10 only) | +| -HideShare | Hide the 'Share' option in the context menu. (Windows 10 only) | ## Debloat Windows diff --git a/Start/start2.bin b/Start/start2.bin new file mode 100644 index 0000000000000000000000000000000000000000..98159fb0e65f33de40f1ddfc545c103385565767 GIT binary patch literal 972 zcmV;-12g>Mdf`g}{7oC20D%kMZc&9!T3<&1Td_%sT#~Plg!x{YpcwlD;n@M80{{SA z_U?Hs-v!~iD`O?Z8eb6SAxM#9bf z?rt(PixR%4S%NUI!enI0*~yyWM|19hNK`211FH;@368%A`3wB&Gyju{_|%AK!%}>{W5pw*2`52Tk724bJT4o`0)%bmY6_%pN(0)JCpp~VY6=~N zA18B{PhScasIz}LLh*ReK*WI~yi?!Zp3ojOLh!ogL5r|tSt1UZV|AB@zD<_xNR{xP z;RrMWVMKg_NY|vhZC$euoHBywtiq>8Xh|@;#P}ecfYOL)`adeTv%Rf;Y|9Aow4_(? zv1laAUWZ%!+ks#!2px@VPWJFf6iqPu+;a{$M39szlw<_C0#)_4-~(GN@zvbW?;3F)boGWW{cq(i$Syi@gc=P;3JuNy85fB^XagfAU%ArhfkWKwhsX8W zA~D6HnJlGjp>42@%zljrINV;hmE+DZ=*}l@VojYEfnU#GZfO?|9?%jiHimZDIz%s% zn}AzW{?C=W#}J}f?`;6Y)xRRF2)K0J*%Nj@gr zx)h`mf%=6sAI=(j-d?n7NQ;22hW4`=>D(0N)+J+6&lx=hau?Z(0CjMDZ?Z+gTvc`$ zGi0qZl1lSQDVO#lTsDZhPM?vsd1K79z`v|v@(ePxg}E1Jxv^M#YAUGW$l}qVK2D0V zH1&IUPe^txnKj`XoS#cyUAwsHd5j&r(i=2!rOQ&bB1c|+V|{S8Q2ZrVlMfKXY0j_t z?ZV+z{@cl*^|lb~(U@JAJIRm@3;EVgf4_!A*;4d$f-jF#J}CS&ohvr)R3Ig(*ubsA uq*-n&{bH0zyCk6Ekv|trEcHQ`WV&ux-r&2z&gp4*b*^o7p9yXVF5`$IrPmDr literal 0 HcmV?d00001 diff --git a/Win11Debloat.ps1 b/Win11Debloat.ps1 index 308c733..f32afef 100644 --- a/Win11Debloat.ps1 +++ b/Win11Debloat.ps1 @@ -25,6 +25,7 @@ param [Parameter(ValueFromPipeline = $true)][switch]$HideWidgets, [Parameter(ValueFromPipeline = $true)][switch]$DisableChat, [Parameter(ValueFromPipeline = $true)][switch]$HideChat, + [Parameter(ValueFromPipeline = $true)][switch]$ClearStart, [Parameter(ValueFromPipeline = $true)][switch]$DisableOnedrive, [Parameter(ValueFromPipeline = $true)][switch]$HideOnedrive, [Parameter(ValueFromPipeline = $true)][switch]$Disable3dObjects, @@ -89,6 +90,65 @@ function RegImport { } +# 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 + $startmenuTemplate = "./Start/start2.bin" + + # 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 + } + else { + # Bin file doesn't exist, indicating the user is not running the correct version of windows. Exit function + Write-Output " Error: Start menu file not found. Please make sure you're running Windows 11 22H2 or later" + 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 + if(-not(Test-Path $defaultProfile)) { + new-item $defaultProfile -ItemType Directory -Force + } + + # Copy template to default profile + Copy-Item -Path $startmenuTemplate -Destination $defaultProfile -Force +} + + # Change script execution based on provided parameters or user input if ((-NOT $PSBoundParameters.Count) -or $RunDefaults -or $RunWin11Defaults -or (($PSBoundParameters.Count -eq 1) -and ($PSBoundParameters.ContainsKey('WhatIf') -or $PSBoundParameters.ContainsKey('Confirm') -or $PSBoundParameters.ContainsKey('Verbose')))) { if ($RunDefaults -or $RunWin11Defaults) { @@ -199,7 +259,16 @@ if ((-NOT $PSBoundParameters.Count) -or $RunDefaults -or $RunWin11Defaults -or ( Write-Output "" - if ($( Read-Host -Prompt "Do you want to make any changes to the taskbar and start menu? (y/n)" ) -eq 'y') { + # Only show this option for windows 11 users + if (get-ciminstance -query "select caption from win32_operatingsystem where caption like '%Windows 11%'"){ + if ($( Read-Host -Prompt "Remove all pinned apps from the start menu? (y/n)" ) -eq 'y') { + $PSBoundParameters.Add('ClearStart', $ClearStart) + } + } + + Write-Output "" + + if ($( Read-Host -Prompt "Do you want to make any changes to the taskbar? (y/n)" ) -eq 'y') { # Only show these specific options for windows 11 users if (get-ciminstance -query "select caption from win32_operatingsystem where caption like '%Windows 11%'"){ Write-Output "" @@ -415,6 +484,11 @@ switch ($PSBoundParameters.Keys) { 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 "" @@ -457,10 +531,11 @@ switch ($PSBoundParameters.Keys) { } } +RestartExplorer Write-Output "" Write-Output "" -Write-Output "Script completed! Please restart your PC to make sure all changes are properly applied." +Write-Output "Script completed!" Write-Output "" Write-Output "" Write-Output "Press any key to continue..."