Deleting files you don't have permission to

Deleting files you don't have permission to

Rate This
  • Comments 1

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.

Leave a Comment
  • Please add 2 and 8 and type the answer here:
  • Post