Force Stop a Windows Service When Stop Option Is Grayed Out

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:

ServiceGrayedOut.png

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:

scquery.png

Next use the following command to force the PID to stop:

taskkill /F /PID 3652

The service should now also be stopped.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: