Link to home
Start Free TrialLog in
Avatar of fselliott
fselliottFlag for United States of America

asked on

How do I write a script to create a user folder and set permissions at the same time?

My goal is to create a user folder, and then assign only the domain admins and the user the ability to open the folder (write, read, edit, etc.).

So far I have:


mkdir  \\servername\subfolder\reports\TOMJONES
echo y| Xcacls.vbs \\servername\subfolder\reports\TOMJONES /I REMOVE
echo y| cacls \\servername\subfolder\reports\TOMJONES /E /G "Domain Admins":F "Administrators":F TOMJONES:F


The folder is created, but the permissions are not being set.  Please help!  Thanks
Avatar of erobby
erobby
Flag of United States of America image

md \\servername\subfolder\reports\TOMJONES
icacls \\servername\subfolder\reports\TOMJONES /grant "Administrators":(F)
icacls \\servername\subfolder\reports\TOMJONES /grant "Domain Admins":(F)
icacls \\servername\subfolder\reports\TOMJONES /grant "TomJones":(F)
ASKER CERTIFIED SOLUTION
Avatar of erobby
erobby
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of fselliott

ASKER

Thank you!
You are more then Welcome and thanks for the points