I was cleaning up orphaned roaming profiles on one of my citrix boxes and ran across a profile I could not delete. in the past a quick reboot of the server solved the issue but not this time.

every time I tried to delete the folder I got the “unable to delete directory: Access denied” error.

I tried claiming ownership (dont’ forget the “replace owner on subcontainers and objects”) and give full access to my useraccount. Still: Access denied.

After some mumbling of dirty words i started to see if the CACLS tool works. And boy does it work!

What did i do?

I went to the command prompt as an administrator. Then i started the CACLS (normally you can run it from everywhere in the prompt).

Checked the help part and got this nice commandlet:

cacls X:\problemfolder /t /e /g Administrators:f

Like so: cacls “c:\documents and settings\blah” /t /e /g Administrators:f

This sets the correct security values to be able to delete the problemfolder.

You can then delete the folder in the same prompt with:

rmdir /S X:\problemfolder

or me being lazy I simply deleted it in windows explorer

You have now deleted your problem folder!

By admin