I wrote a tool in C# which is supposed to delete user folders of old users after some security checks.
The problem is although I start the application as administrator (with UAC to minimum settings) the application does not seem to have sufficient rights... I get exceptions which say access denied.
If I try to manually delete the folder in the explorer I get prompted to do this as administrator and I click proceed ("fortsetzen" in my German version) and it works fine, which proves I/my login does have the necessary rights.
If I use cmd.exe with del /S /Q C:\User\{user}"
it says access denied as well though...
What do I need to do in order to make it work?
Shouldn't being administrator be enough?
Additional info:
OS: Windows 7 Enterprise successfully joined to a samba domain.
It's all domain users.
User-profiles exist only locally.
I am member of a domain group called "edv" (German equivalent of "IT")
That group is added to the local administrator group of the client, where my application runs.
SOLVED thanks to lzam
Sollution:
I had to do the following things:
- Take Ownership
- Set Rights
- Remove write protection flag
- Delete it
For further information on how to do that in C# see my original stackoverflow post here.