Fix Icons and Search Data

This how-to covers fixing Start Menu, Search, and File Explorer aspects.

Here are some reasons you may want to rebuild:

  1. Files are missing icons, they have a generic blank document.

  2. File previews are corrupt or not generating.

  3. Various UI element icons are missing or incorrect.

Scripted Method

This is an automated script that will do the entire task for you. Please read over it to learn more.

Scripted Method via EXE

If you prefer you can use this compiled EXE (made with AutoHotKey) that will download this script and run it for you. The benefit here is you do not have to change your execution policy. Here is the source code of that script contained in the EXE:

#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
Run PowerShell.exe -ExecutionPolicy Bypass -Command "Invoke-WebRequest -Uri "<version>/SearchRebuild.ps1" -OutFile "$env:temp\ico_srch_rbld.ps1"; cd $env:temp; ./ico_srch_rbld.ps1;"


Please close all open services and programs. Games, web browsers, gaming software, chat clients, etc. Anything not vital to the operation of the Windows core. These extra processes can lock files and prevent them from being cleared by this script.

The first line in this script checks for admin user space. If you are not admin, it will prompt to be ran as admin.

The next portion ends certain running processes.

Stop-Service -Name WSearch
Set-Service -StartupType Disabled WSearch
taskkill /f /im explorer.exe
taskkill /f /im RuntimeBroker.exe
taskkill /f /im dllhost.exe
taskkill /f /im taskmgr.exe
  • Windows Search (WSearch.exe) is self explanatory. This needs to end to delete the search database.

  • Explorer (explorer.exe) is Windows File Explorer. It needs to end because it actively uses icon and thumbnail cache that needs to be deleted at C:\users\<yourname>\appdata\local\Microsoft\Windows\Explorer.

  • Runtime Broker (RuntimeBroker.exe) is a process for managing UWP apps. Ending this process is harmless in itself but prevents deleting files contained at C:\users\<yourname>\AppData\Local\Packages\<appname>. Windows will start it again after brief moment has passed. The good news is scripts execute fast enough that killing it once is all that's needed.

  • COM Surrogate (dllhost.exe) is a process for managing appliction connections to COM Objects. Again this is harmless to end because none of the affected programs will crash or end. A COM Object is used to read and write icon and thumbnail cache for Explorer. A COM Surrogate is used to connect to these two together. Ending it may be required as sometimes the pipe is left open and the files are locked from deletion.

  • Task Manager (taskmgr.exe) is self explanatory but this process directly pulls from the icon cache to show you the icons for processes in the list. If it's running, you can't delete the cache.

With all of the above ended, you can now delete the caches.

# Delete the icon and thumb cache.
remove-item "$env:localappdata\Microsoft\Windows\Explorer" -recurse -force
# This line isn't needed. This file is created by Explorer and only exists while it runs.
#remove-item "$env:localappdata\IconCache.db" -force
# delete search data.
remove-item "C:\ProgramData\Microsoft\Search" -recurse -force
# End these and clean up.
taskkill /f /im SearchApp.exe
remove-item "$env:localappdata\Packages\Microsoft.Windows.Search_cw5n1h2txyewy" -recurse -force
taskkill /f /im StartMenuExperienceHost.exe # It's normally already killed when you kill explorer. Here just in case.
remove-item "$env:localappdata\Packages\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy" -recurse -force
remove-item "$env:localappdata\Packages\windows.immersivecontrolpanel_cw5n1h2txyewy" -recurse -force

I have included a useless command that is commented out for knowledge. The file IconCache.db is only created when Explorer is running. When not running, the file does not exist. Trying to delete this file is pointless these days.

And lastly, restart the Windows Search Service, pause for 2 seconds so you can read the output if you want. After it times out, reboot.

# Enable and start Windows Search
Set-Service -StartupType Automatic WSearch
Start-Service -Name WSearch
start-sleep 2
# reboot
shutdown /r /t 0

When you log back in, all your services are started again and you can continue use of Windows as normal.

Errors Are Normal

Yes you will see some text stating there are errors because the process can't be found or something doesn't exist. Some files or folders are locked by Windows being owned by SYSTEM. These permissions are not messed with in any way. Processes that are going to be ended may not be running after all. PowerShell throws an error and moves on.

Windows search (WIN + Q) may have missing icons after a reboot! This is normal! Give Windows a moment to generate all the icon caches again. If the problem does not correct itself in about 5 minutes time, please reboot.