I’ve occasionally come across a Windows Service that I am unable to stop because the options to do so are unavailable. When looking at the specific service through Services, the start, stop, pause, and resume buttons might all be grayed out:
One reason this might happen is if a process hangs while attempting to stop at which point the GUI won’t let you interact with the service.
A trick I’ve learned is to kill the specific PID (process identifier) for the service which will in turn stop the service.
First identify the service PID by running the following command:
sc queryex TrustedInstaller
Note that you must use the actual name of a service in the command and NOT the display name. In the screenshot of the service pictured above, the display name is Windows Modules Installer while the actual service name is TrustedInstaller.
The PID number will be listed in the results:
Next use the following command to force the PID to stop:
taskkill /F /PID 3652
The service should now also be stopped.