我尝试用sc delete <服务名>删除一个Windows服务,并遇到以下错误:

[SC] DeleteService FAILED 1072: 指定的服务已标记为删除。

我已经做了:

Stopped the service, obviously. The sc queryex "<service name>" gives the following result: 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 is closed (taskkill /F /IM mmc.exe), Ensured that Event Viewer is closed, Removed the key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\<service name> from the registry. Due to this removal, services.msc still shows the service (with a name, but no status or startup type), but the description is “<Failed to Read Description. Error Code: 2 >”. When attempting to view the properties, “The system cannot find the file specified.” is shown five times.

问题依然存在。

下一步是什么?


当前回答

在我的例子中,服务名称是“Monitor”,它也被一个名为“Monitor”的windows服务使用,当我试图更新我的服务时,我尝试卸载它们,安装程序试图删除windows服务“Monitor”,但它不能,安装总是回滚。

我最终将我的服务重命名为其他东西

其他回答

如果@MainMa提供的步骤不起作用,请执行以下步骤

处理步骤步骤1尝试从windows任务管理器或使用taskkill /F /PID删除进程。你可以通过命令'sc queryex '找到进程的pid。如果仍然无法卸载,请尝试下一步。

2 .如果以上情况

运行Autoruns for Windows按名称搜索服务并删除结果。

我也遇到了同样的问题,最后我决定终止服务进程。

尝试以下步骤:

获取服务的进程id Sc queryex <服务名> 用 taskkill /F /PID <业务PID> .使用实例

这对我来说很管用: 我遇到了同样的问题:我的服务卡在了“标记为删除”中。 -我打开了services.msc 我的服务确实显示为运行,尽管它已经卸载了。 -我点击了停止 收到一条错误消息,表示服务不处于接收控制消息的状态。 尽管如此,服务还是停止了。 —关闭services.msc。 -重新开放services.msc。 -服务消失(不再显示在服务列表中)。

(当时的环境是Windows 7。)

关闭当前打开的每个窗口,然后运行以下命令解决了我的问题:

taskkill /F /IM mmc.exe

在我的例子中,服务名称是“Monitor”,它也被一个名为“Monitor”的windows服务使用,当我试图更新我的服务时,我尝试卸载它们,安装程序试图删除windows服务“Monitor”,但它不能,安装总是回滚。

我最终将我的服务重命名为其他东西