In Windows, sometimes a service may become unresponsive or stuck and not be stopped using the usual net stop or Task Manager methods. In such cases, you can force kill the service using the taskkill command. This tutorial will guide you through the process of force killing a service on Windows.

Advertisement

Problem:

In our AWS windows server, the Amazon SSM Agent service was hung during the startup. The service status kept showing starting always.

Hanged Service on Windows

Now the only option available to forcefully kill this service by the process id on the Windows system. Below instructions will help you with it.

Solution:

  • 1. Find the Service name – Right-click on the service and open properties. Here you will find the service name under the General tab. For example, view the below screenshot.

    In my case the service name is AmazonSSMAgent

  • 2. Find the PID – Then execute the below command with the service name identified above.
    sc queryex [servicename]
    

    This will show you the service details on the console as below.

  • 3. Kill Process by PID – Find out the service’s PID (process id) and force kill process by using the below command. Use pid number found with the previous command.
    taskkill /f /pid <PID>
    

    Replace with the actual Process ID of the service you want to force kill.

  • All done. You can now start your service now.

Conclusion

Force killing a service using the taskkill command is a quick and effective way to stop unresponsive or stuck services on Windows. However, it should be used as a last resort, as it can result in data loss or other issues if incorrectly used. Always save any important data before attempting to force kill a service, and use this method only if other methods have failed to stop the service.

Share.

3 Comments

  1. I once used task kill with the windows update service. Unfortunately, now I need to reopen it because a program needs window update security to open it after a long time. What should I do? Ty sir /madam

  2. Thanks, unfortunately even with the ‘force’ parameter, it seems sometimes Windows refuses… ‘access is denied’

Leave A Reply


Exit mobile version