Unable to terminate process


  • I have a .NET console app that is being scheduled to run through windows scheduler.  Sometimes this process hangs and I'd like to be able to kill it.  Unfortunately, I get an "access denied" error whenever I try to kill it with task manager.  I've tried the kill command from the platform sdk and even tried the code here:  With the latter solution, I'm able to add the debug privilege with no errors, but the TerminateProcess still fails with "Access Denied."

    Is there some alternative technique to killing processes spawned with the scheduler?
    Monday, February 12, 2007 10:46 PM

All replies

  • kernel32!TerminateProcess is failing with access denied?  Are you calling that as a full privilege admin?

    Thursday, February 15, 2007 11:46 PM
  • Yes.  My user account is a local admin on the box.  I'd have to jump though some IT hoops to get the box's administrator login.  Do you think that would make a difference?
    Friday, February 16, 2007 3:20 PM
  • If you have administrative rights you can try the ZeroWave too:
    Terminate any process you cannot with a normal program.
    Friday, October 26, 2007 2:51 PM
  • The Administrator can't kill jobs running under LocalSystem.  In a command window, use the "at" command to create a Command Window running under LocalSystem.  (Make sure your start time is after the current time):

    Code Block

    The current time is: 10:57:32.87
    Enter the new time:

    C:\>at 10:58 /interactive cmd
    Added a new job with job ID = 1

    The current time is: 10:57:52.47
    Enter the new time:

    In the new Command Window, you should be able to use taskkill on XP or the Resource Kit kill command.

    Friday, October 26, 2007 6:01 PM