I’ve once again been asked how do you kill a service in Windows NT/2000/XP/2003 which appears to have hung whilst stopping or starting. You may have realised that you can’t kill the process from your standard TaskMgr session.
This is very common whilst developing a service and the official answer is to either: Restart the machine or run the service as your own user account.
If you choose the latter you can then kill the service using your own task manager.
However, if you really need to run the service as Local System or the service was already set to that and you can’t restart the machine there is a work-around. I can’t remember where I learnt this one and so I can’t credit the author – I have been using this for at least 5years though.
Open a command prompt ( if you don’t know how you shouldn’t be reading this!). Do “at 14:05 /INTER taskmgr”, where 14:05 is a time immediately in the future e.g. Now()+1minute.
What is this doing? Well it’s using the “Task Scheduler” service to schedule a Task Manager process to start in 1 minutes time to run interactively.
Why is this any use? The scheduling service runs as “Local System” and so any process it spawns also runs as Local System. Local System can kill any other Local System process – hence it can kill your Hung service.
When the TaskMgr window pops up it’s not easy to tell that it’s a ‘special’ one, thus I’d recommend closing all task manager windows before you schedule the command.