Whenever something goes wrong with a process or app on our PCs, our first inclination is to dive into the Task Manager and end that task. Usually, it works like a charm and kills the program freezing or misbehaving. But when the Task Manager itself throws the 'Access Denied' message your way, and you're unable to terminate the process, it's natural to get stumped. But there are ways to fix this frustrating problem.

Why is access denied when trying to end the task? There could be many reasons why you can't end a task. Sometimes, it's a simple matter of inadequate administrative privileges. But sometimes, the reasons could be more complicated. It could be an anti-virus software that's preventing the process from ending. Alternatively, it could be that the process is currently locked in waiting for some kernel resource, like a (buggy) driver, because of which you can't end it. Here's how you can resolve this problem.

1. Run Task Manager as Administrator

If the problem in ending the task is because of inadequate permissions, then running the task manager as an administrator will solve this issue.

  1. Go to the search option from the taskbar.
  2. Type Task Manager in the search menu.
  3. Task Manager will appear in the search results. From the right pane, click on 'Run as administrator'.

Task Manager will open with administrative privileges. Now, try to end the task that was causing the problem.

2. Use the WMIC Command to Terminate the Process

If you can't end the process with administrative privileges, try using the WMIC (Windows Management Instrumentation Command-line) command in Command Prompt to terminate it.

  1. Open the Command Prompt window as an administrator on your PC.
  1. Click 'Yes' from the User Account Control window to proceed.
  2. Next, type the following command in the CMD window and press 'Enter' to execute it: wmic process where name='processname.exe' call terminate.

    Replace processname.exe with the actual name of the process in the single quotes. For example, to terminate File Explorer, enter the command: wmic process where name='explorer.exe' call terminate.
  1. If you don't know the process's name, go to the Task Manager, right-click the process, and select 'Go to Details' from the menu.
  1. You'll find the name of the process there.
  1. This command sends a soft request to the specified program to close it and gives it a chance to gracefully shut down. If the process responds to the command, it'll either shut down right away or first ask for your confirmation and then end. Go to the Task Manager to see if it worked.
  2. If the process is still running, use this command to terminate it: wmic process where name='processname.exe' delete.

    Again, replace processname.exe with the actual process. Taking the same example as above of File Explorer, the command would become: wmic process where name='explorer.exe' delete.

This command doesn't send a request to the application to close it. Instead, it forcefully terminates the process. Go to the Task Manager to check if it worked.

3. Use the Taskkill Command to Terminate the Process

If the WMIC commands weren't successful in terminating the task/ process, then it's time for the big guns. Taskkill Command is the most forceful option for killing a process and can terminate almost any process.

To run the Taskkill command, you'll need either the process name or the PID.

  1. Open an elevated Command Prompt window, i.e., CMD with administrative privileges.
  2. Then, enter the following command and press 'Enter' to execute it: taskkill /f /im processname.exe. Again, replace processname.exe with the actual name of the process, which you can get from the Task Manager, as explained in the above section.

    The /f flag is used to indicate that the program needs to be forcefully terminated, even if it is resisting termination.
  1. If you get an error executing this command that says that the process could not be terminated because of a child process running, execute the command with the additional /t flag that kills child process: taskkill /f /t /im processname.exe; replace processname.exe with the actual name.

Go to the Task Manager and check if the termination was successful.

4. Reboot your PC

If the cause behind this issue is the fact that the process is locked in waiting for a kernel resource or stuck in some other loop, then rebooting your PC is the only way to solve this problem. It's not ideal to reboot the PC in the middle of something, but restarting your PC is the only way to terminate the process if nothing else has worked till now.

That's it. If you're facing a problem while trying to end a task/ process in Windows 11 where the Task Manager is giving the 'Access denied' message, the above ways will help you get around it and terminate the process regardless. If there is a process that cannot be killed using even the above methods, check your system for malware.