Link to home
Create AccountLog in
Avatar of barnyhall
barnyhall

asked on

Permissions Script using Xcalc

I have set Permissions using calcs as below

for /d %%1 in (*) do echo y|cacls %%1 /t /g %%1:f administrators:f  "domain Admins":F

with the folder name being the same as the user name the %%1 works to reset permissions

what I need to do is set the user who would be the %%1 to just have read write but no modify on existing files.

I believe you need to use xcalcs.vbs to this but I don't know how to set the %%1 using that

can anyone help?
ASKER CERTIFIED SOLUTION
Avatar of Davis McCarn
Davis McCarn
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of barnyhall
barnyhall

ASKER

if I put rw together then the  script errors it will run with r or w on there own but not together
for /d %%1 in (*) do echo y|cacls %%1 /t /g %%1:r %%1:w administrators:f  "domain Admins":F
says invalid argument
Are you testing this from the command prompt or in a script file?
both
You need to switch to icacls and here is the syntax: http://ss64.com/nt/icacls.html
Click the Hotfix Download Available button to get a 32bit version: http://support.microsoft.com/kb/943043

for /d %%1 in (*) do echo y|icacls %%1 /t /g %%1:(r,w) administrators:f  "domain Admins":F
getting closer

for /d %%1 in (*) do echo y|icacls %%1 /t /grant %%1:(r,w) administrators:f  "domain Admins":F

sets on the top folder but doesn't seem to change the files and folders in them, the user still has modify on all files and folders apart from the root dir
for /d %%1 in (*) do echo y|icacls %%1 /t /grant %%1:(oi)(ci)(r,w) administrators:f  "domain Admins":F
"(OI)(CI)          This folder, subfolders, and files." http://ss64.com/nt/icacls.html
its seems to add rather then replace the current permissions for the folders and files is there a switch to replace existing permissions