TaskList, TaskKill, Remote Machine, Spinning Process, and killing that runaway process! 2-steps!

I’ve been dealing with a “application” these days that is absolutely driving me nuts.  In short, this application that runs in user-mode context and displays data on the screen while locking the keyboard makes for a difficult situation when said application decides to “hang.”  Until the company who writes this dashboard application provides a solution, or until I give up on it altogether, I’ve had to figure out a way to get the machine back to working order where I could control it again.  I thought it might be useful to share what I did as it might just save someone out there who might experience a similar issue – you can decided if this is useful or not.

We are running the Team Foundation Server (TFS) Work Item Manager on a couple of machines that are used for display purposes. These machines run connected to larger televisions and display how our team is doing on our key projects. For more information, see the following post that shares some details. Telerik recently released a Beta 4 (this product has been in a Google-like beta period!) and it now supports Visual Studio SCRUM 1.0. Because we are running a couple of projects on SCRUM 1.0, we went ahead and upgraded the machines. Oops…

The Project Dashboard now gets in a never-ending circle anytime you attempt to get access to the configuration (we store our configuration in source control to share settings – much easier) and looks something like this –


Because this machine has no keyboard & mouse (yes, we could add one but that is painful), it makes it particularly difficult when we are RDP’ing to the machine and it hangs. This is where I learned this trick…

Discovering Process ID for the Runaway Application

The first thing I wanted to see if I could do remotely was to determine the Process Id (PID) on the remote machine.  I was able to do this using native Windows 7 (or Server 2008 R2) tools and here are the steps.

  1. Open a command prompt
  2. Type tasklist /? to see a list of available commandsimage
  3. Type tasklist /s {remote computer name} /u {domain | username} /p {password}
  4. This should return a list of running processes on the remote machine – take note of the PIDimage

After you have the PID, you can now utilize another tool to actually force the process to shut down

Effectively shutting down the Application remotely

The next step is to shutdown the process remotely.  This is easily available in-box using the taskkill.exe command that in Windows 7 & Server 2008 R2.  The steps to shut the runaway process are outlined below.

NOTE:  For demonstration purposes, I’ve started Notepad in a user session on a remote server and that session is Notepad.exe


  1. Open a command prompt
  2. Type taskkill /? to see the available optionsimage
  3. To stop the remote process, type taskkill /s {remote pc} /u {domain | username} /p {password} /PID {process id}


This should return, if it works, a message stating “Success:  The process with PID {PID} has been terminated.  This is it.  This is all you have to do to get this mis-behaving process out of the picture! 


In today’s post, I just went off the normal path of my typical post and shared a newly discovered “trick” that makes my life a bit easier when I have a remote machine who I can’t access because the “screen” is locked.  This might be a unique scenario and if so then please accept apologies for taking up space on the internet – but I felt the need to put it together since I couldn’t really easily locate other posts relating to it.




Comments (15)

  1. B.T. says:

    Very useful trick that I didn't know yet. Just helped me alot!

  2. Veerendra says:

    Excelent trick

  3. vijay says:

    If you want to programmatically check if the task is running and kill only if it running, check the command @


  4. cem says:


  5. Kyeremeh says:

    nice one

  6. bibo Kid says:

    Thanks.. Worked like a charm!

  7. Mani says:

    I was killed the my process through cmd ,but still it is available in tasklist

  8. Victor says:

    Very useful, thanks for posting

  9. Psy says:


  10. WD-40 says:

    Very useful, thanks for posting.

  11. silentxboxb says:

    just had this happen to me, and this got me running in 30 minutes or less.Excellent tip thank you.

  12. ExchAdminInd says:

    Thanks a Ton! You saved my day!

  13. Shweta says:

    Thanks It works very well……..which saves my time ….. 🙂

  14. prasad says:

    I had tried as you given but when i use command TASKLIST /s IP_ADDRESS it runs for a few time and giving error as "RPC server is unavailable". I uses windows 8. What can i do to resolve this problem???

  15. prasad says:

    sir i have trued this but it gives me error "RPC server is unavailable". what can i do to resolve it?