"You Need Permission to Perform This Action"? Take Ownership with takeown & icacls
Windows refuses to open, move, or delete a folder: “You need permission to perform this action,” “Access is denied,” or “You require permission from … to make changes.” You’re an administrator, yet it still says no.
Why: NTFS permissions and ownership are separate from your admin status. This usually hits files from an old user account, a drive moved from another PC, or a leftover C:\Users\<old-name> folder — the files are owned by an account (or SID) that no longer means anything here. The fix is two steps: take ownership, then grant yourself full control.
Only do this on your own data — old user folders, a migrated drive, your documents. Never take ownership of
C:\Windows,Program Files, or system folders: it breaks Windows servicing and security. If a system file is denying you, that’s a different problem — don’t force it.
The two-command fix (admin Command Prompt)
Replace the path with your folder:
takeown /f "D:\OldUserData" /r /d y
icacls "D:\OldUserData" /grant "%username%":F /t
takeown … /r /d ymakes you the owner of the folder and everything inside (/r= recurse,/d y= auto-answer yes).icacls … /grant "%username%":F /tgrants Full control to your account, applied to all subfolders and files (/t).
Taking ownership alone isn’t enough — it only lets you change permissions. The icacls line is what actually grants access, so run both.
Prefer the GUI?
- Right-click the folder → Properties → Security → Advanced.
- Next to Owner, click Change → type your username → Check Names → OK.
- Tick Replace owner on subcontainers and objects → Apply.
- Back on the Security tab, Edit → add your account with Full control → OK.
FAQ
It worked on the folder but not files inside. You missed the recursion flags — rerun with takeown /f … /r /d y and icacls … /t (the /r and /t apply it to everything underneath).
Should I take ownership of Windows or Program Files to fix an update error? No. Forcing ownership of system folders breaks servicing. Update/repair issues have their own fixes — e.g. component store corruption.
This is an old account’s folder I want gone. Take ownership (above) so you can copy/delete it — and remove the account itself the clean way per Delete a Windows user account.
Sources: Microsoft Learn — takeown command, Microsoft Learn — icacls command