Windows Server – How to efficiently set user security permissions

windows

I have a USERS folder and inside it i have one folder for each USER e.g.

USER
 - Adrian
 - Betty
 - Carlos

I want to:-

  • allow the domain\admin to have full
    control over all files and folder
  • allow individual domain[named_user]
    to have full control over the
    contents of their own folder BUT
    cannot delete or rename their named
    folder (or any other for that
    matter.)
  • no domain\user can access another's
    folder.

I have hundreds of such user folders and thousands more files. Currently, the permission is all messed up such that some user folders now allow domain\user while others don't. Some user folders have other domain[named_user] allowed for that folder.

Whenever I change a permission for a folder, it recurse into that folder and take a very long time.
Is there a way to quickly remove all domain\user from all folders' permission?
Thanks in advance!

Best Answer

I'd make use of icacls in this case. Here's small script that I used to do something similar: Using ICACLS to set permissions on user directories

You'll need to tweak it for your situation, but all the commands are there.