How to solve the “specified service has been marked for deletion” error

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

I try to remove a Windows Service with sc delete < service name> , and encounter the following error: I try to use sc delete < service name> Windows service, and encountered the following error:

[SC] DeleteService FAILED 1072: [SC] DeleteService FAILED 1072:

The specified service has been marked for deletion. specified service marked for deletion.

What I ‘ve already done: I have done:

  • Stopped the service, informational: obviously, service has been Stopped. The sc queryex "< service name>" gives the following result: sc queryex "< service name>" gives the following results:

     SERVICE_NAME: Stub service TYPE : 10 WIN32_OWN_PROCESS STATE : 1 STOPPED WIN32_EXIT_CODE : 1067 (0x42b) SERVICE_EXIT_CODE : 0 (0x0) CHECKPOINT : 0x0 WAIT_HINT : 0x0 PID : 0 FLAGS : 
  • >Ensured that Microsoft Management Console was closed (taskkill /F /IM mmc.exe), Ensured that the Microsoft Management Console closed (taskkill /F /IM mmc.exe),

    Ensured that the Event Viewer was closed, Ensured that the Event Viewer was closed,

  • 1

    2 3 Removed the key HKEY_LOCAL_MACHINE\\ \\ \\CurrentControlSet\\ \Services\\< service name> From the registry. deleted from the registry key HKEY_LOCAL_MACHINE \\ \ CurrentControlSet \\ Services \ < Service name & GT; .

    Due to this removal, services.msc still shows the service (with a name, but no status or startup type), but the description is “< MSC services.msc still shows the service (with name, but no status or startup type), but described as “< Unable to read description. Error Code: 2 >” . error code: 2>” . When we need to view the properties, “the system cannot find the file specified.” is shown five times. attempts to examine the property. .

The problem persists. problems still exist.

What is the next step? what do you do next?


# 1 floor

reference: https://stackoom.com/question/1OH70/ how to solve the specified service has been marked for deletion – error


# 2 floor

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

  1. SysInternals’ Process Explorer is opened.SysInternals’ Process Explorer. Closing it should lead to automatic removal of the service. Closing it will cause the service to be automatically deleted.

  2. Task Manager is the opened. Task Manager has been opened.

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

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

  4. Event Viewer is the opened. Event Viewer has been opened. Again, this is the same as the third point. .

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

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

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


# 3 floor

This can also be caused by leaving the Services console open. may also be caused by opening the service console. Windows won’t actually delete the service until it is closed. Windows does not actually delete the service until it is closed.


# 4 floor

In my case, it was caused by unhandled exception while creating eventLog source. is caused by an exception that was not handled when the eventLog source was created. Use try catch to pin point the cause. Use try catch to identify the cause.


# 5 floor

finds another thing to check – look it up in the task manager – if other users are connected to this box, even if they are “disconnected,” you must actually log them out to eventually delete the service.


# 6 floor
Deleting registry keys as suggested above got my service stuck in the stopping state. Deleting registry keys as suggested above will stop my service. The following procedure worked for me: is useful for me:

open task manager > select services tab > select the service > right click and select “go to process” > Right click on the process and select End process open task manager > Select the service TAB & GT; Select service & GT; Right-click and select Go to Process & GT; Right-click the process, and select end process

Service should be gone after that after that Service should be gone

Read More: