Microsoft Secure Tech Accelerator
Apr 03 2024, 07:00 AM - 11:00 AM (PDT)
Microsoft Tech Community
Deleting files you don't have permission to
Published Feb 08 2019 12:40 PM 259 Views

First published on MSDN on Oct 02, 2008

I've been struggling with this one for a bit, but finally found the answer today. On one of my lab machines, I have two hard drives. At one point I was dual booting Server 2008 and Vista x64. I had no need for the Vista x64 system anymore, so I wanted to reclaim the disk space it was eating up on my D: drive. I had a pretty basic install, so there were only a couple folders to delete. Unfortunately, Program Files, Program Files (x86) and Windows didn't want to delete. The newer permissions system with Vista/Server 2008 does a better job of locking down these files. I really needed to reclaim disk space, and finally figured out how to remove the files from the old system. The following two commands did it.


takeown /f "Directoy to reclaim" /r /a  (This takes ownership)
icacls "Directory to reclaim" /grant administrators:F /t     (This grants permissions to the administrators group)


I hope this helps someone over come the problem I had. PLEASE BE CAREFUL with these commands though. They can do SIGNIFICANT DAMAGE if used incorrectly. I also used a tool called Easy BCD to remove the Vista option from the boot configuration menu.

Version history
Last update:
‎Apr 28 2020 11:43 AM
Updated by: