+ Post New Thread
Results 1 to 4 of 4
Scripts Thread, iCacls in Coding and Web Development; Hi All, I have a problem where some files in some home folders are losing their inherited permissions, it is ...
  1. #1

    Join Date
    May 2013
    Posts
    29
    Thank Post
    4
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    iCacls

    Hi All,

    I have a problem where some files in some home folders are losing their inherited permissions, it is affecting over 200 home folder. Basically I need a script/batch file that can take the permissions from the Root folder (which are all fine) and propagate them down, this would resolve the issues we are having.

    I can do it individually and it resolves the issues however its a little impractical to do this 200 times, folder by folder.

    Any one have a batch file or something that can do this? I have used iCacls in the past but I can't seem to get this to work this time.

    Any help appreciated

  2. #2
    nickbro's Avatar
    Join Date
    Jul 2010
    Location
    Gilwern, Wales
    Posts
    3,520
    Thank Post
    37
    Thanked 501 Times in 432 Posts
    Rep Power
    113
    This is the one I've used
    Code:
    @echo off
    
    REM Create list of folders
    dir /a:d /b "c:\Home Directories" >C:\users.txt
    
    REM Read each line from just created text file...
    for /f "tokens=*" %%G in (C:\users.txt) do (
    
    takeown /f "c:\Home Directories\%%G" /r /d y
    icacls "c:\Home Directories\%%G" /setowner "domain\%%G" /T /C /Q
    icacls "c:\Home Directories\%%G" /T /C /Q /RESET
    
    echo.
    )
    Takeown takes ownership
    then you set the owner
    and reset the permissions
    Last edited by nickbro; 4th February 2014 at 05:10 PM.

  3. Thanks to nickbro from:

    ChristianDavies (5th February 2014)

  4. #3

    Join Date
    May 2013
    Posts
    29
    Thank Post
    4
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Cheers! A bit of alteration and testing and that worked

  5. #4

    Join Date
    May 2008
    Location
    Norfolk
    Posts
    114
    Thank Post
    16
    Thanked 2 Times in 1 Post
    Rep Power
    13
    Any idea if this will work on server 2012. Just carried out a server upgrade from 2003 to 2012 and its randomly altered student home folders permissions and ownership. I used Robocopy for the transfer and previously it worked a treat from 2003 to 2008 but not this time.

SHARE:
+ Post New Thread

Similar Threads

  1. help with icacls
    By RabbieBurns in forum Scripts
    Replies: 1
    Last Post: 1st March 2013, 07:30 PM
  2. Setting permissions with icacls
    By roontoon in forum Windows
    Replies: 0
    Last Post: 16th February 2013, 11:15 PM
  3. Replies: 12
    Last Post: 22nd December 2011, 04:39 AM
  4. Replies: 0
    Last Post: 4th March 2011, 07:22 AM
  5. iCACLS .. Woops.
    By jmair in forum Windows Server 2008
    Replies: 2
    Last Post: 14th October 2010, 01:10 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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