Alpha Core

A personal weblog about the world and things that matter in it.

Access Denied

Permission DeniedAre you having problems in Windows Vista to get rid of a directory with limited access permissions an installer or uninstaller did a bad job on? Maybe some program created some files with very restrictive permissions? Then here are 3 easy steps to take total control over them.

Before you proceed, make sure it’s a permission issue and not just some file that is still in use. In that case, instead of proceeding below, you’d either make sure the program that is using the file is closed or use a tool such as Process Explorer to close the file handle.

I also want to point out that you should take care for what directory you’re doing this and for what reason, e.g. don’t execute these steps on your “C:\” drive (supposing that’s where your Windows is installed on), because that would mean all users would get full control over every other user’s files and worse, it would expose your whole operating system to possible malicious software (even with UAC enabled).

Typically you would want to follow these steps for a folder you want to get rid of anyway, either by afterwards manually deleting it or by allowing an uninstaller to do its job properly, thanks to these modified relaxed permissions.

Be careful, you are about to modify multiple directory and file permissions without the possibility to undo your actions. By proceeding, you fully agree that the consequences of any actions or decisions taken on the basis of the information provided here is your own responsibility.

  1. Open a command prompt with elevated rights like this:
    • Press the Win keyboard key or click the Vista Start button
    • Type “cmd” (without quotes) into the Start Search textbox
    • Press Ctrl+Shift+Enter keyboard shortcut. Ctrl+Shift+Enter is the general keyboard shortcut that triggers elevation to “Run as Administrator”.
    • Press Alt+C or press Continue to confirm the UAC elevation warning prompt (if enabled).
  2. Take ownership of everything in that folder by executing the following command in the command prompt (replace “D:\Foo\Bar” with your problem directory):
    takeown /F "D:\Foo\Bar" /R /D Y
  3. Reset permissions and then give all users full control over everything in it by executing the following commands in the command prompt (again, replace “D:\Foo\Bar” with your problem directory):
    icacls "D:\Foo\Bar" /reset /T /C
    icacls "D:\Foo\Bar" /grant Users:(OI)(CI)F /T /C

All users now have full control over the directory.

| Posted in Software | No comments

No comments yet. Be the first.

Leave a reply