Error 21: Windows Search Service Could not Start on Local Computer

When you attempt to start the Windows Search (WSearch) service via the Services MMC, the following error may occur:

Windows could not start the Windows Search service on Local Computer

Error 21: The device is not ready.

windows search service could not start - error 21

The result is the same when you run the net start wsearch command from a Command Prompt window. It returns the following error:

The Windows Search service could not be started.

A system error has occurred.

System error 21 has occurred.

The device is not ready.

windows search service could not start - error 21

You may have tried running the Windows Search troubleshooter already.

Cause

This error occurs if the “DefaultApplicationsPath” or “TempPath” registry values point to a non-existent drive letter. A user on your computer may have redirected the Windows Search data folder to a removable (USB) drive and that drive letter (e.g., E:\ ) may now be unavailable.

In that case, the event log entries are created:

The Windows Search Service has failed to create the new search index. Internal error <1, 0x80070003, Failed to create application directory: E:\Search\Data\Applications>" will be created.
The Windows Search service terminated with the following error:
The device is not ready.

Windows Search Error 21 can also happen if the Windows Search index database (Windows.edb) is locked. The error code 21 could also mean “ERROR_LOCK_VIOLATION” – The process cannot access the file because another process has locked a portion of the file.



Resolution

To resolve the Windows Search service error 21, follow the steps below:

Step 1: Fix the Windows Search folder paths in the registry

  1. Download AdvancedRun from Nirsoft.net and run it.
  2. Using AdvancedRun, start the Registry Editor (regedit.exe) as TrustedInstaller.
    advancedrun start regedit.exe

  3. In the Registry Editor, go to the following branch:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Search\Gathering Manager
  4. Double-click DefaultApplicationsPath and set its data as follows:
    %ProgramData%\Microsoft\Search\Data\Applications\
  5. Double-click TempPath and set its data as follows:
    %ProgramData%\Microsoft\Search\Data\Temp\usgthrsvc
  6. Go to the following branch:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Search
  7. Double-click DataDirectory and set its data as follows:
    %ProgramData%\Microsoft\Search\Data\
  8. Double-click DefaultDataDirectory and set its data as follows:
    %ProgramData%\Microsoft\Search\Data\
    Important: Make sure the registry value type of the above values is REG_EXPAND_SZ. If the value is REG_SZ, delete it and create a new value of type REG_EXPAND_SZ.
  9. Exit the Registry Editor.

Attempt to start the Windows Search service now. If the same error occurs, proceed to Step 2 below.


Step 2: Delete the Windows Search index database

Open Task Manager and kill searchindexer.exe if it exists. We need to delete or rename the file “Windows.edb” in the following folder:

C:\ProgramData\Microsoft\Search\Data\Applications\Windows\

Open admin Command Prompt and run the following commands:

sc config wsearch start= disabled

net stop wsearch

rd /s /q C:\ProgramData\Microsoft\Search\Data\Temp

cd /d C:\ProgramData\Microsoft\Search\Data\Applications\Windows\

ren Projects Projects.old

del windows.edb /a

reg add "HKLM\SOFTWARE\Microsoft\Windows Search" /v SetupCompletedSuccessfully /d 1 /t reg_dword /f

sc config wsearch start= auto

net start wsearch

This resets the Windows Search index.

See if you’re able to start the Windows Search service now.


One small request: If you liked this post, please share this?

One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:
  • Pin it!
  • Share it to your favorite blog + Facebook, Reddit
  • Tweet it!
So thank you so much for your support. It won't take more than 10 seconds of your time. The share buttons are right below. :)

Ramesh Srinivasan is passionate about Microsoft technologies and he has been a consecutive ten-time recipient of the Microsoft Most Valuable Professional award in the Windows Shell/Desktop Experience category, from 2003 to 2012. He loves to troubleshoot and write about Windows. Ramesh founded Winhelponline.com in 2005.

Leave a Comment