Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Chicago, Illinois, USA
    Posts
    185
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Batch file to change permissions.

    Good morning all. I have a folder on a network share on a Win2K server. Domain users do not have any rights to the folder, but they have Read rights to the items in the folder (this works for a particular purpose we have).

    I have a non-technical user who will be adding files to the folder (she has full control over the folder and all of its contents). I'd like to write a batch file (with Windows Script Host, perhaps??) that will modify the rights of the files in the folder for her, so that she doesn't have to do each one manually (she'll be adding files in batches).

    The inherited rights of the items in the folder are:

    Administrative User (full control)
    Domain Admins (full control)
    Recruiting (full control)

    To each item, I need to add:

    Domain Users (Read)

    I can either completely replace the permissions on each file, or simply add the Domain Users global group security.

    Well, I say "I can", but actually I "can't." I don't know how to write a batch file that will get at those security attributes on the files. Can anyone help me please? Thanks in advance...

    klyjen

  2. Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Batch file to change permissions.

    You can use the CACLS command to do this
    <pre>d:folder> CACLS *.* "domain users":r
    </pre>


    Type CACLS /? for the syntax.

    StuartR

  4. #3
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Chicago, Illinois, USA
    Posts
    185
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Batch file to change permissions.

    Thanks! And, just be clear--that simply modifies the permissions, right? It doesn't actually remove any of the inherited permissions on the item??

    jen

  5. #4
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Batch file to change permissions.

    If you want to edit the ACL rather than replace it the syntax is
    <pre>d:folder> CACLS /E /G *.* "domain users":r
    </pre>

    Here is the output of CACLS /?
    <pre>CACLS filename ]<!/t> [/E] [/C] [/G usererm] [/R user [...]]
    [/P usererm [...]] [/D user [...]]
    filename Displays ACLs.
    /T Changes ACLs of specified files in the current directory and
    all subdirectories.
    /E Edit ACL instead of replacing it.
    /C Continue on access denied errors.
    /G usererm Grant specified user access rights.
    Perm can be: R Read
    W Write
    C Change (write)
    F Full control
    /R user Revoke specified user's access rights (only valid with /E).
    /P usererm Replace specified user's access rights.
    Perm can be: N None
    R Read
    W Write
    C Changrse (write)
    F Full control
    /D user Deny specified user access.
    Wildcards can be used to specify more that one file in a command.
    You can specify more than one user in a command.
    </pre>

    StuartR

  6. #5
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Chicago, Illinois, USA
    Posts
    185
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Batch file to change permissions.

    Beautiful; thanks very much. I just wanted to be sure I wasn't going to lose the inherited permissions on the items.

    Thank you again for your help.

    jen

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •