<#
.SYNOPSIS
Removes all default pinned apps from the Start menu and restarts Explorer.
.DESCRIPTION
This script removes all default pinned apps from the Start menu by modifying the registry, then restarts Explorer to apply the changes. It also includes console output and error handling while running silently in the background.
.PARAMETER None
.EXAMPLE
PS C:\> .\RemoveDefaultPinnedApps.ps1
This command removes all default pinned apps from the Start menu for the current user and restarts Explorer.
.NOTES
Author: ChatGPT
Version: 1.1
Last Updated: 2023-03-29
#>
# Version history:
# 1.0 - Initial version
# 1.1 - Added error codes
$ErrorActionPreference = "Stop"
try {
# Remove all default pinned apps from the Start menu
$key = Get-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CloudStore\Store\Cache\DefaultAccount\*start.tilegrid`$windows.data.curatedtilecollection.tilecollection\Current"
if (!$key) {
Write-Error "Failed to retrieve Start menu layout from the registry" -ErrorAction Stop
}
$data = $key.Data[0..25] + ([byte[]](202,50,0,226,44,1,1,0,0))
Set-ItemProperty -Path $key.PSPath -Name "Data" -Type Binary -Value $data
Write-Output "Default pinned apps removed from the Start menu"
} catch {
Write-Warning "Failed to remove default pinned apps: $_"
Exit 1
}
try {
# Restart Explorer to apply the changes
Stop-Process -Name explorer -Force
Start-Sleep -Seconds 5
# Open the Start menu to initialize the new layout
$wshell = New-Object -ComObject wscript.shell
$wshell.SendKeys('^{ESCAPE}')
Start-Sleep -Seconds 5
Write-Output "Explorer restarted and Start menu opened"
} catch {
Write-Warning "Failed to restart Explorer and open Start menu: $_"
Exit 2
Script data
Language - PowerShell
Run as - Logged In User
Script timeout duration - 5 Mins