I have a program that needs to change the permissions on specified folder. What I must do first is to remove any permission that was given to the folder by inheritance (i.e. remove all actuel permission) and add new permissions for specifics users/groups.
I know I can easily remove a permission for a folder for a specific user when I know that user, but is there a way to wipe all permission so that I can start fresh or do I need to find a way to find all existing permission and then remove them one by one ?
What I need to do more specifically is to create a new folder WITHOUT the inherited permissions and set my own.
To be more specific, I would like to do as though I created the directory then I went into security, advanced and removed the inheritance.
So I've been doing some test and what I needed to do is called the SetAccessRuleProtection method from the DirectorySecurity and apply it to my DirectoryInfo.
I tried it and it worked.