Yes, I Really Do Want to Delete The Windows Folder
Does this sound familiar? You just bought a new hard drive, so the old one becomes your “drive d” data disk and you fresh install onto “drive c”
After finishing you notice that there is ~35gb on your old disk left under the the windows folder.
Fair enough, now I want to remove it, so you right click delete. Windows prompts you to elevate you agree and then “Access denied” folder cannot be removed.
“How can this be? I’m an elevated Admin!” you might shout.. perhaps with more profanity.
The reason many of these files can’t be removed is they are not controlled by the Administrators group. Nearly all of them are explicitly owned and controlled by the “TrustedInstaller account.” This was added during the Vista timeframe to keep users from shooting themselves in the foot.
For the 98% case it makes sense that I dont want anything deleting my system files. On the 2% chance such as a new hard drive these are the steps to turn off this sanity check:
1. Navigate to the old copy of Windows (d:\windows NOT %windir%)
2. Right click Properties – Security Tab – Click Advanced
3. In Advanced Security Settings goto the Owner tab
4. Click Edit accept the elevation and declare your account as owner
5. In that same tab check the “Replace owner on subcontainers and objects” as well
6. Wait for the change to propigate
7. Go back to Adv Security Settings
8. Remove all Permission entries then add one for yourself with “Full Control” again propigating and replacing on all child objects
9. Click ok til back to Explorer
10. Delete all files like normal
If you still cannot delete all the files spot check that your account is owner and has full rights now. Assuming that is correct double check with Process Monitor that there are no open handles to the folder.