如果系统上没有Windows服务的可执行文件,如何卸载该服务?我不能运行installutil -u
,因为系统上没有剩余的可执行文件。我仍然可以在服务控制台中看到该服务的条目。
出现这种状态的原因可能是因为msi包中的一个问题,它没有正确地删除服务,但是一旦服务处于这种状态,我如何修复它呢?
发布于 2008-12-01 13:43:24
您应该能够使用sc.exe卸载它(我认为它包含在Windows资源工具包中),方法是在“管理员”命令提示符下运行以下命令:
sc.exe delete <service name>
其中,<service name>
是您在服务管理控制台中看到的服务本身的名称,而不是exe的名称。
您可以在System文件夹中找到sc.exe,它需要具有管理权限才能运行。More information in this Microsoft KB article。
或者,您也可以直接调用DeleteService()接口。这种方式有点复杂,因为您需要通过OpenSCManager()等获取服务控制管理器的句柄,但另一方面,它使您能够更好地控制正在发生的事情。
发布于 2008-12-01 13:35:43
我刚在windows XP上试过,它起作用了。
本地计算机: sc \。删除服务名称
Deleting services in Windows Server 2003
We can use sc.exe in the Windows Server 2003 to control services, create services and delete services. Since some people thought they must directly modify the registry to delete a service, I would like to share how to use sc.exe to delete a service without directly modifying the registry so that decreased the possibility for system failures.
To delete a service:
Click “start“ - “run“, and then enter “cmd“ to open Microsoft Command Console.
Enter command:
sc servername delete servicename
For instance, sc \\dc delete myservice
(Note: In this example, dc is my Domain Controller Server name, which is not the local machine, myservice is the name of the service I want to delete on the DC server.)
Below is the official help of all sc functions:
DESCRIPTION:
SC is a command line program used for communicating with the
NT Service Controller and services.
USAGE:
sc
发布于 2008-12-01 23:30:40
我最喜欢的方式是使用Sysinternals Autoruns应用程序。只需选择该服务,然后按delete。
https://stackoverflow.com/questions/330836
复制相似问题