Being a Windows Server Administrator, you certainly have several responsibilities towards the job. You need to be in control of the things in order to keep running everything smoothly. Even a trivial possibility of anything going wrong should be dealt with utter diligence.
Now, during a normal day at work, you might come across a stubborn Windows Service which is stuck at starting/stopping state since what seems like an eternity. At such a moment of crisis, you would want to make a decision of killing the service in order to avoid rebooting the server in middle of the noontide.
Considering the normal case scenario, any service could hang, be it a deadlock situation or the resource limitation. Although, it might frequently happen in application services such as Microsoft Exchange (POP3 and IMAP). You can use the TaskKill command to terminate the culprit service and avoid the reboot mechanism in middle of business hours.
Here’s how to do so :
How To Force Stop A Windows Service Using Command Prompt In Windows 10/8.1/8/7
1. Press + R and type services.msc in the Run dialog box, hit Enter key to open Services snap-in.
2. Now on the right side pane of Services, search for the service by its name. For instance, if you are looking for Microsoft Passport service, find it by scrolling down to the corresponding name and double-click it.
3. In the service property sheet shown below, note down Service Name on the top in General tab. Remember this name as it will be used to find its PID (Process ID) and kill the task. You can see here that I can’t stop the Microsoft Passport service, as the Stop button is not active.
4. Open administrative Command Prompt and type this command after substituting the <SERVICENAME> with actual service name you noticed in step 3.
sc queryex <SERVICENAME>
5. From the results of the above query, make a note of PID.
6. On the same Command Prompt window, type the following, where PID is the Process ID you just copied, and hit Enter.
taskkill /f /pid PID
This will kill the culprit service forcibly and put it on rest. In case you later need to start the service, you can do it simply from service property sheet shown in step 3.