Kill stuck Windows service using sc queryex and taskkill

Windows Services can sometimes have a nasty habit of getting stuck in the stopping or starting state. Some believe that at this point there is no alternative but to reboot the server to clear the problem.

However, the following trick usually will work.

The first step is to right click and select Properties on the offending Windows Service in order to find the actual Service Name.

Ex: Services > Microsoft FTP service

Start > Administrative Tools > Services


The next step is to do an sc queryex on the Windows Service in order to find the Process ID.

sc queryex ftpvc


The Process ID is 5180.  So now we can issue the taskkill /F command on the process.

taskkill /PID 6524 /F


Another thing to remember: in Windows 2008, if we are not running the command prompt with ‘run as administrator’, we will get an access denied error on the delete.

Leave a Comment