How to fix Windows error 5 (ERROR_ACCESS_DENIED)
This means Windows refused the action because the account running it lacks permission. Elevating or fixing permissions resolves it. Jump to your situation below or work through the methods in order.
This means Windows refused the action because the account running it lacks permission. Elevating or fixing permissions resolves it. Jump to your situation below or work through the methods in order.
Error 5 (ERROR_ACCESS_DENIED) means Windows blocked the action because the account performing it lacks the necessary permission. The common causes are running something that needs elevation from a normal (non-administrator) prompt or session, file or folder permissions that exclude your account, a service configured with a log-on account that has no rights to what it needs, or security software blocking the operation. The fix is to run the program or command as administrator, and if that is not enough, grant your account the right permissions or ownership of the file or folder, correct a service's log-on account, and check whether antivirus is intervening. Most everyday cases are solved simply by elevating; the rest come down to permissions.
Windows guards files, folders, services and system actions with permissions. Error 5 is the access control system doing its job: the account trying to act does not have the right it needs, so the operation is refused.
The fix follows the cause. If the action needs administrator rights, elevating provides them. If a specific file or folder denies your account, adjusting its permissions or taking ownership grants access. A service may be running under an account without rights, and security tools can block actions that look risky.
“Error 5 is the permissions wall. First question, did you run it as administrator? Half the time elevating is the whole fix. If not, then some specific file or folder is denying your account, so I check its Security tab, grant the right permissions, or take ownership if it is being stubborn. For a service, I look at which account it logs on as, because that account might not have rights to what it is touching. And occasionally antivirus is the one saying no.”
sfc /scannow DISM /Online /Cleanup-Image /RestoreHealth
Error 5 is a permissions block, so try Run as administrator first, which fixes many cases. If access is still denied, adjust the file or folder permissions or take ownership, check a service's log-on account, and test with security software paused before re-enabling it.
If elevating and fixing permissions do not help, a corrupt security descriptor on the target or a restrictive policy may be involved. Comparing permissions against a working machine, or resetting them with icacls, can isolate it. You can also submit your error to us for a tailored fix.