We help IT Professionals succeed at work.
Get Started

setting file/ folder permissions by script

1,218 Views
Last Modified: 2012-05-08
I have a shared drive full of user home folders (about 90) and I want to create a script that sets the permissions on these folders as follows;

Folder name = Username (\share\private\ASMITH is the folder for ASMITH)

Administrators should have full control on the folder and all sub folders/ files

The user who's folder this should have;
On the folder it's self (full control - delete, change permissions, and change owner);
Traverse Folder / Execute File
List Folder / Read Data
Read Attributes
Read Extended Attributes
Create Files / Write Data
Create Folders/ Append Data
Write Attributes
Write Extended Attributes
Delete Subfolders and Files
Read Permissions

On all subfolders and files (full control - change permissions and change owner)
Traverse Folder / Execute File
List Folder / Read Data
Read Attributes
Read Extended Attributes
Create Files / Write Data
Create Folders/ Append Data
Write Attributes
Write Extended Attributes
Delete Subfolders and Files
Delete
Read Permissions

I am sure I can do this with xcacls but am not sure of the complete command syntax.

The idea is to create a script (or batch file .bat or .cmd) that
1) Reads the folder name and stores in a variable
2) Runs xcacls using the variable as both the destination folder and username to set permissions as listed above
3) Precedes to the next folder and repeats
4) Logs any errors to a text file

The server is Windows 2K3 R2 STD 32bit fully patched

Hope someone out there can help

eb
Comment
Watch Question
This problem has been solved!
Unlock 1 Answer and 20 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE