Home
%3CLINGO-SUB%20id%3D%22lingo-sub-333178%22%20slang%3D%22en-US%22%3EDeleting%20files%20you%20don't%20have%20permission%20to%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-333178%22%20slang%3D%22en-US%22%3E%0A%20%26lt%3Bmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22text%2Fhtml%3B%20charset%3DUTF-8%22%20%2F%26gt%3B%3CSTRONG%3E%20First%20published%20on%20MSDN%20on%20Oct%2002%2C%202008%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%3CP%3EI've%20been%20struggling%20with%20this%20one%20for%20a%20bit%2C%20but%20finally%20found%20the%20answer%20today.%20On%20one%20of%20my%20lab%20machines%2C%20I%20have%20two%20hard%20drives.%20At%20one%20point%26nbsp%3BI%20was%20dual%20booting%20Server%202008%20and%20Vista%20x64.%20I%20had%20no%20need%20for%20the%20Vista%20x64%20system%20anymore%2C%20so%20I%20wanted%20to%20reclaim%20the%20disk%20space%20it%20was%20eating%20up%20on%20my%20D%3A%3C%2Fimg%3E%20drive.%20I%20had%20a%20pretty%20basic%20install%2C%20so%20there%20were%20only%20a%20couple%20folders%20to%20delete.%20Unfortunately%2C%20Program%20Files%2C%20Program%20Files%20(x86)%20and%20Windows%20didn't%20want%20to%20delete.%20The%20newer%20permissions%20system%20with%20Vista%2FServer%202008%20does%20a%20better%20job%20of%20locking%20down%20these%20files.%20I%20really%20needed%20to%20reclaim%20disk%20space%2C%20and%20finally%20figured%20out%20how%20to%20remove%20the%20files%20from%20the%20old%20system.%20The%20following%20two%20commands%20did%20it.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3Etakeown%20%2Ff%20%22Directoy%20to%20reclaim%22%20%2Fr%20%2Fa%26nbsp%3B%20(This%20takes%20ownership)%20%3CBR%20%2F%3E%20icacls%26nbsp%3B%22Directory%20to%20reclaim%22%20%2Fgrant%20administrators%3AF%20%2Ft%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20(This%20grants%20permissions%20to%20the%20administrators%20group)%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EI%20hope%20this%20helps%20someone%20over%20come%20the%20problem%20I%20had.%20%3CSTRONG%3EPLEASE%20BE%20CAREFUL%20%3C%2FSTRONG%3E%20with%20these%20commands%20though.%20They%20can%20do%20%3CSTRONG%3E%20SIGNIFICANT%20DAMAGE%20%3C%2FSTRONG%3E%20if%20used%20incorrectly.%20I%20also%20used%20a%20tool%20called%20Easy%20BCD%20to%20remove%20the%20Vista%20option%20from%20the%20boot%20configuration%20menu.%3C%2FP%3E%0A%20%0A%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-333178%22%20slang%3D%22en-US%22%3EFirst%20published%20on%20MSDN%20on%20Oct%2002%2C%202008%20I've%20been%20struggling%20with%20this%20one%20for%20a%20bit%2C%20but%20finally%20found%20the%20answer%20today.%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-333178%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESecurity%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Ewindows%20server%202008%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Ewindows%20vista%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft
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.