Discussion Locked

Script for Assigning Permissions

0 helpful
10 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I maintain a Windows NT (SP 6a) network. We have a drive mapped for users to temporarily store files. Each user has his/her own folder. We wipe this drive at the end of every week and have a simple sscript file for re-creating it. Right now all domain users have change permissions, and IS has full control (security/ntfs permissions).

We want change this to give the user change permissions to his/her specific folder, domain users: read, and IS: full control.

I am looking for a script the will read the folders in the drive and apply the security permissions as outlined above.

Please Help!

Thanks,
Stephen

10 replies

by nicholasp

I know this is not what you are looking for.... but why don't you create this structure once and then each week delete the individual files rather than deleting everything and recreating?

by vagab0nd

Take a look at Microsoft Knowledge base article Q180464 - it's the detailed explanation of the script you need.

Hope this helps you

by sheastr

You should investigat useing the CACLS command from the resource. This allows you to set ntfs permissions through the command line.

cacls c:\user1 /t /e /c /g User1:C
cacls c:\*.* /t /e /c /g domain users:R
cacls c:\*.* /t /e /c /g IS:F

This would accomplish what you are looking for. With some work you could create a script that would automate this with less typing involved.

by rcwalters

Slight change of plans. I reread it and see that you don't need to create the dirs. Forget the users.txt, but you still need y.txt containing a Y and a carriage return. Then run the following:

for /f %a in ('dir /ad /b') do cacls %a /G "DomainUsers":R /G "IS":F /G %a:C

by rcwalters

Now I see that it didn't take my first answer. :(

Create a text file named "y.txt", containing the single letter y followed by a carriage return. This only needs to be done once if you keep y.txt around for next week.

Then, the above line does it all. You just need to modify it to do a 'dir /ad /b' with the path being the path to the dir containing your temp dirs in question. This will assign the cacls permissions, and answer the question when it asks "are you sure?" Also be sure to include the path with the filename of y.txt unless y.txt is in your current directory.

This discussion is closed to new replies.