cannot reset file permissions on two folders

I am working on a clients PC and there are two folders that I cannot delete. I am logged in as the administrator and resetting the permissions still doesn't allow me to delete those two folders.
How do I forcibly take control of them so that I can delete them and all the files underneath those two folders?
Who is Participating?
Gabriel CliftonConnect With a Mentor Net AdminCommented:
OK, here is something to try.
1. Download PsExec.exe from
Boot into Safe Mode to ensure nothing is accessing the files in the folder.
Move PsExec to C:\Temp
Open a command prompt with Administrator Privileges and CD into C:\temp.
Run: psexec -s -i cmd.exe, this installs a temporary service which will open a command prompt under LOCAL SYSTEM account. The service will be automatically deleted after you exit from the psexec prompt.
Run: ATTRIB -R -S -H <folder>
Run: TAKEOWN /F <folder> /R /D Y, this will set the Administrators group as owner, it recurses all folders and files in the folder.
To give the Administrators group full control rights, run ICACLS <folder> /grant administrators:F /T, the /T indicates that this operation is performed on all matching files and directories below the directories specified.

This process may take a few logoff/logon or reboots to catch every file and folder.
Mohammed AsishCommented:
What error message do you get when you attempt to delete these folders?
Gabriel CliftonNet AdminCommented:
Can you make yourself the owner of the folders, then change permissions and finally delete?
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

johnny181Author Commented:
access denied on lots of the files underneath those two folders.
I've also tried Takeown /R /F C:\Temp and that didn't reset them
BTW, the two folders are in C:\Temp
EirmanChief Operations ManagerCommented:
Try this really excellent and free utility to remove the locks on chosen files and folders ...
johnny181Author Commented:
that did the trick !!
There are some reasons why this may happen:
-file System corruption/ACL corruption
-user does not know how to reset ACLs or does not execute the takeown command elevated
-the folder path is very very long or contains characters that are forbidden

So reset the ownership info using an elevated command line and then modify ACLs so that your own user shows up with full perms.
->if that still does not let you delete them, use some tool that overcomes some foldername limitations that explorer has: delinvfile. It might help you deleting it.
->if unsuccessful, do a chkdsk on your drive and retry
->if even that does not work, boot winPE (any setup disk would do) and there delete from the command line. If no setup disk is around, download the knoppix CD.

Will definitely work.
Ah, I see I came too late. Well, since the system account cannot do anything that the admin can't when it comes to ACLs, your error before must have been having not elevated. Next time simply rightclick cmd.exe and select run as administrator, before you use takeown.
Gabriel CliftonNet AdminCommented:
True usually admin can do this, but sometimes permissions can get severely messed up and system needs to do the command.
By definition, this may not be... Who cares :)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.