Blog Post

Core Infrastructure and Security Blog
1 MIN READ

Deleting files you don't have permission to

ronalg's avatar
ronalg
Icon for Microsoft rankMicrosoft
Feb 08, 2019

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 😧 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.

Updated Apr 28, 2020
Version 3.0
No CommentsBe the first to comment