File I can't take ownership of
Give Unlocker a try. If there is any open file handle it will let you close it so you can successfully delete the file.
If that doesn't work for some reason, try BootDeleter. It will delete the file for you upon reboot, before Windows has a chance to lock it on you.
Both utilities are freeware.
Sometimes it just won't let you change permissions because some process is using the file, or if you are trying to edit a folder's properties, then a process has a file that is within that dir or subdir open.
I had the problem described today, and I solved it by opening Process Explorer. Then, I went to the "Find" Menu, and selected the "Find Handle or DLL" option. In the dialog that comes up, I searched for the name of the folder I was having issues with. The search results told me which process had an open file within the folder. I killed the process, and then I had no problems with that folder's permissions.
Try Ultimate Windows Tweaker, which adds a "take ownership" element to the context menu.
Portable application, does not require an install.
============================================================================ REPORTED ISSUE - Cannot take ownership of an NTFS folder via standard method
Folder Properties \ Security TAB \ Advanced button \ Change Owner
.
REPORTED ISSUE - CANNOT DELETE FOLDER or FILES,
.
========
SCENARIO
I get each time I try to perform ANY function with an NTFS folder called 'templates'.
CURENT RESULT - INFO: Access is denied. ( "G:\OLD Drive\Program Files\Microsoft Visual Studio x\ VC\VCWizards\CodeWiz.NET\Component\templates" )
============
TEST1 - FAIL
Followed enclosed instructions under proposed solution -
Download PsExec.exe from Sysinternals
C:\Windows\system32>TAKEOWN /F "G:\OLD Drive\Program Files" /R /D Y
===================================
RESULT (see INFO in last statement)
SUCCESS: The file (or folder): "G:\OLD Drive\Program Files" now owned by user "P
CDGROUP\PCD$".
SUCCESS: The file (or folder): "G:\OLD Drive\Program Files\Microsoft Visual Stud
io 8" now owned by user "PCDGROUP\PCD$".
SUCCESS: The file (or folder): "G:\OLD Drive\Program Files\Microsoft Visual Stud
io 8\VC" now owned by user "PCDGROUP\PCD$".
SUCCESS: The file (or folder): "G:\OLD Drive\Program Files\Microsoft Visual Stud
io 8\VC\VCWizards" now owned by user "PCDGROUP\PCD$".
SUCCESS: The file (or folder): "G:\OLD Drive\Program Files\Microsoft Visual Stud
io 8\VC\VCWizards\CodeWiz" now owned by user "PCDGROUP\PCD$".
SUCCESS: The file (or folder): "G:\OLD Drive\Program Files\Microsoft Visual Stud
io 8\VC\VCWizards\CodeWiz\.NET" now owned by user "PCDGROUP\PCD$".
SUCCESS: The file (or folder): "G:\OLD Drive\Program Files\Microsoft Visual Stud
io 8\VC\VCWizards\CodeWiz\.NET\Component" now owned by user "PCDGROUP\PCD$".
INFO: Access is denied. ( "G:\OLD Drive\Program Files\Microsoft Visual Studio 8\
VC\VCWizards\CodeWiz\.NET\Component\templates" )
C:\Windows\system32>
==========
CONCLUSION
Problem not resolved
===============
TEST2 - SUCCESS
CAVEAT - I was only able to succeed here because the folder sits on a drive that is not my primary boot (c:) and as such could be safely taken offline. I ensured all windows were closed before actioning.
Microsoft Windows [Version 10.0.10586]
(c) 2015 Microsoft Corporation. All rights reserved.
C:\Windows\system32> cd "G:\OLD Drive\Program Files\Microsoft Visual Studio 8\VC\VCWizards\CodeWiz\.NET\Component"
C:\Windows\system32>G:
G:\OLD Drive\Program Files\Microsoft Visual Studio 8\VC\VCWizards\CodeWiz\.NET\Component>chkdsk /f
The type of the file system is NTFS.
Cannot lock current drive.
Chkdsk cannot run because the volume is in use by another
process. Chkdsk may run if this volume is dismounted first.
ALL OPENED HANDLES TO THIS VOLUME WOULD THEN BE INVALID.
Would you like to force a dismount on this volume? (Y/N) Y
Volume dismounted. All opened handles to this volume are now invalid.
Volume label is DATABAK.
Stage 1: Examining basic file system structure ...
986368 file records processed.
File verification completed.
12 large file records processed.
0 bad file records processed.
Stage 2: Examining file name linkage ...
1261166 index entries processed.
Index verification completed.
0 unindexed files scanned.
0 unindexed files recovered to lost and found.
cd..
G:\OLD Drive\Program Files\Microsoft Visual Studio 8\VC\VCWizards\CodeWiz\.NET\
rd Component
======================================================
RESULT - The Component folder was successfully removed
I have had this issue a couple of times. Closing and restarting explorer resolved the issue. A quick and dirty solution, but it worked. http://www.howtogeek.com/198815/use-this-secret-trick-to-close-and-restart-explorer.exe-in-windows/