views:

83

answers:

1

Some services can't start or stop with Service Management Console. ex) DcomLaunch, SamSs

These services's stop button is disabled on Service Management Console. So, we can't stop the services.(Even if we have a Administrator account)

Is it possible? How can I do that?

Thanks in advance.

+1  A: 

Your service ultimately calls SetServiceStatus to specify its status. Part of this is what controls it accepts. If you don't specify SERVICE_ACCEPT_STOP, the service cannot be shutdown. For managed code, you can set the CanStop property on ServiceBase.

Another possibility that allows a bit more finegrained control is to change the ACL on your service. MSDN has a sample article here. This is usually used if you want to allow non-admin users to be able to control when your service is running.

Please think very carefully if your service shouldn't be stopped - users should be in control of their machine and allowed to stop services at will.

Michael
Thank you very much!
Benjamin