Set unique permissions on multiple folders [Server 2003]

TheGrandHooHa

Senior member
Jun 28, 2001
408
0
0
Recently, we moved our user's data folders (students, faculty, and admin at a local school district) to a new server and had to re-create all the user folders. Our file structure is, basically, this:

D:\Users
------
Faculty
--jdoe
--gdoe
Students
--fdoe
--rdoe
Staff
--adoe
--zdoe

I need some way to, en masse, go through and provide read and write permissions to the folders. They inherit permissions for DOMAIN\Administrators, but on each user's folder, I need to have that particular user have read and write permissions. (I.E., the user 'adoe' should have R+W access to the 'adoe' folder, along with the administrators whose access is inherited). CACLS doesn't help, because I have to type in each user's name and folder name by hand. Selecting multiple folders does not work also, because it still requires touching each folder.

There are over 2000 of these folders, so I need a script or a nice program that can do this.

Any suggestions?
 

nweaver

Diamond Member
Jan 21, 2001
6,813
1
0
netsh script? Havn't used cacls, but I looked at it. Can't you write scripts using it?

My first guess would be to dump the username list to file, and then either have netsh call it (not sure if that works) or be lazy like me...I write a perl script to write my netsh script, cause I can get perl to read/format stuff easier, and then just loop through all lines in the file.
 

TheGrandHooHa

Senior member
Jun 28, 2001
408
0
0
I don't see an easy way to write a script using Cacls, but I really don't know anything about perl and other such languages. Basically, you'd have to have a script that replace %username% with a given username in a Cacl command, run that command, then do it again with the next name. But I don't know anyting about perl or any scripting really - it's technically not my job so I never took the time to learn the stuff, but now this all fell in my lap.

If you can suggest a solution or some quick perl resources I can look into it maybe.
 

nweaver

Diamond Member
Jan 21, 2001
6,813
1
0
what is the exact command (in a single line) to change the folder, i.e.

cacls C:\path\to\users\folder\students\studentname readwrite permissinos for username

then you have a large batch file that has 1000 lines, one for each user. I can probably generate the file if you can get me a list of all usernames on a single line (and usernames MUST MATCH FULDERNAME, if not, let me know) and the exact line you would type in from a command prompt.

I would give you back fixpermissions.bat that would have the 1000 lines.
 

pulsedrive

Senior member
Apr 19, 2005
688
0
0
There is a way to do this easily with 2003, I just can't remember it off the top of my head, but I will look into it and see what I can find. It has just been a while since I set it up like that.
 

nweaver

Diamond Member
Jan 21, 2001
6,813
1
0
we traded some PM's and I sent him some samples of the scripts I have written that were similar, was just wondering if he got it done.