Stopping Stuck Process that is Still Stopping

Today I had the task of stopping a process that was marked as STATE 3 - STOPPING. Initially I had asked the service to stop using the Windows Services Control Panel however after a few minutes of sitting there at STOPPING, it became aparent that it wasnt going down easily.

I opened up my trusty SysInternals tool - Process Explorer to force the service to stop however, I realised that there were multiple instances of the service running - all with the same name.This was an SQL Server Instance service and therefore just listed, (like the other three instances) as SQL Server.

So next, using the Service Control command line, I determined the Process ID of the service. To do this I needed the service name.

So Step 1: Get Service name

sc query

Shows all running services and both their friendly and system names.Once i had the system name, I can get more info (including the service process id).

Step 2: Get Service Process ID

sc queryex MSSQL$INSTANCE

Once I have the Process ID (PID) then I can use Process Explorer to force it shut.

The other option would be to use the command line PSKILL.

Thanksfully this cleared it out and I was able to restart the service successfully.