How to solve "The specified service has been marked for deletion" error

This can also be caused by leaving the Services console open. Windows won't actually delete the service until it is closed.


I had the same problem, finally I decide to kill service process.

for it try below steps:

  • get process id of service with

    sc queryex <service name>

  • kill process with

    taskkill /F /PID <Service PID>


There may be several causes which lead to the service being stuck in “marked for deletion”.

  1. SysInternals' Process Explorer is opened. Closing it should lead to automatic removal of the service.

  2. Task Manager is opened.

  3. Microsoft Management Console (MMC) is opened. To ensure all instances are closed, run taskkill /F /IM mmc.exe.

  4. Services console is opened. This is the same as the previous point, since Services console is hosted by MMC.

  5. Event Viewer is opened. Again, this is the same as the third point.

  6. The key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\{service name} exists.

  7. Someone else is logged into the server and has one of the previously mentioned applications opened.

  8. An instance of Visual Studio used to debug the service is open.