Kill a process which is hung

Many a time while troubleshooting issues with various applications I have had troubles with services going to a hung state. When the service is in a stopping state you can simply go ahead and kill it from the task manager but what when it is hung at "starting" ? Also not all services run as processes in task manager. For instance, if Exchange POP3 service is stuck in a 'stopping' state. You cant go into task manager and kill the process because its not there. And there isnt a way to force a service to stop in the service manager.

The following commands had been a great help for me.

To kill any process be it hung at "stopping" or "starting" state do the following :-

Open command prompt in elevated mode ie; right click on command prompt and "Run as Administrator".

Enter the following command:
sc queryex (service name)
This will give you the PID(process id) To get the service name, right click on the service under general tab you can see Service Name listed.

Then enter the following command:
taskkill /f /pid (Process id)

Hope you found it usefull.

Note: The process id will keep changing, hence always check the process id before running the taskkill command.