Skip to content

Instantly share code, notes, and snippets.

@LinkPhoenix
Created October 20, 2025 00:05
Show Gist options
  • Select an option

  • Save LinkPhoenix/65e3c59e1586539b76c3cb5a7b0a2545 to your computer and use it in GitHub Desktop.

Select an option

Save LinkPhoenix/65e3c59e1586539b76c3cb5a7b0a2545 to your computer and use it in GitHub Desktop.
PowerShell script to reset Windows 11 icon and thumbnail caches for fixing broken or missing explorer thumbnails.
<#
.SYNOPSIS
Reset Windows 11 icon and thumbnail caches to fix broken or outdated explorer thumbnails.
.DESCRIPTION
This script was created to fix broken taskbar or explorer thumbnails, particularly when shortcuts are renamed.
It stops Windows Explorer, clears both icon and thumbnail cache databases, and restarts Explorer cleanly.
This process can also solve other visual cache inconsistencies or shell display issues in Windows 11.
.PARAMETER None
No parameters required. Must be executed with Administrator privileges.
.EXAMPLE
.\Reset-ThumbnailCache.ps1
Stops and restarts Explorer while clearing all thumbnail and icon cache files.
.NOTES
Created: 2025-10-20
Version: 1.0
#>
# Stop Explorer process
Get-Process explorer -ErrorAction SilentlyContinue | Stop-Process -Force
# Define cache file patterns
$cacheFolder = Join-Path $env:LocalAppData 'Microsoft\Windows\Explorer'
$iconCacheFile = Join-Path $env:LocalAppData 'IconCache.db'
$iconCachePatterns = 'iconcache_*.db','thumbcache_*.db'
# Remove main IconCache.db if it exists
if (Test-Path $iconCacheFile) {
Remove-Item $iconCacheFile -Force -ErrorAction SilentlyContinue
}
# Remove all icon and thumbnail cache files
Get-ChildItem -Path $cacheFolder -Include $iconCachePatterns -File -ErrorAction SilentlyContinue |
ForEach-Object {
Remove-Item $_.FullName -Force -ErrorAction SilentlyContinue
}
# Restart Explorer
Start-Process explorer.exe
# Output result
Write-Host 'Icon and thumbnail caches have been cleared. Explorer has been restarted.' -ForegroundColor Green
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment